2019-01-17 19:04:01 +00:00
|
|
|
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
|
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
|
|
|
import frappe
|
2021-08-31 13:03:16 +00:00
|
|
|
import os
|
|
|
|
import json
|
|
|
|
from frappe.permissions import add_permission, update_permission_property
|
2019-01-17 19:04:01 +00:00
|
|
|
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2019-01-17 19:04:01 +00:00
|
|
|
def setup(company=None, patch=True):
|
2021-08-31 13:03:16 +00:00
|
|
|
# Company independent fixtures should be called only once at the first company setup
|
|
|
|
if frappe.db.count("Company", {"country": "United States"}) <= 1:
|
|
|
|
setup_company_independent_fixtures(patch=patch)
|
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2021-08-31 13:03:16 +00:00
|
|
|
def setup_company_independent_fixtures(company=None, patch=True):
|
2019-01-17 19:04:01 +00:00
|
|
|
make_custom_fields()
|
|
|
|
add_print_formats()
|
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2020-06-11 16:03:43 +00:00
|
|
|
def make_custom_fields(update=True):
|
2019-01-17 19:04:01 +00:00
|
|
|
custom_fields = {
|
|
|
|
"Supplier": [
|
|
|
|
dict(
|
|
|
|
fieldname="irs_1099",
|
|
|
|
fieldtype="Check",
|
|
|
|
insert_after="tax_id",
|
|
|
|
label="Is IRS 1099 reporting required for supplier?",
|
|
|
|
)
|
2020-03-24 06:01:41 +00:00
|
|
|
],
|
|
|
|
"Sales Order": [
|
|
|
|
dict(
|
|
|
|
fieldname="exempt_from_sales_tax",
|
|
|
|
fieldtype="Check",
|
|
|
|
insert_after="taxes_and_charges",
|
|
|
|
label="Is customer exempted from sales tax?",
|
|
|
|
)
|
|
|
|
],
|
|
|
|
"Sales Invoice": [
|
|
|
|
dict(
|
|
|
|
fieldname="exempt_from_sales_tax",
|
|
|
|
fieldtype="Check",
|
|
|
|
insert_after="taxes_section",
|
|
|
|
label="Is customer exempted from sales tax?",
|
|
|
|
)
|
|
|
|
],
|
|
|
|
"Customer": [
|
|
|
|
dict(
|
|
|
|
fieldname="exempt_from_sales_tax",
|
|
|
|
fieldtype="Check",
|
|
|
|
insert_after="represents_company",
|
|
|
|
label="Is customer exempted from sales tax?",
|
2022-03-28 13:22:46 +00:00
|
|
|
)
|
|
|
|
],
|
2020-03-24 06:01:41 +00:00
|
|
|
"Quotation": [
|
2022-03-28 13:22:46 +00:00
|
|
|
dict(
|
2020-03-24 06:01:41 +00:00
|
|
|
fieldname="exempt_from_sales_tax",
|
|
|
|
fieldtype="Check",
|
|
|
|
insert_after="taxes_and_charges",
|
|
|
|
label="Is customer exempted from sales tax?",
|
|
|
|
)
|
|
|
|
],
|
2019-01-17 19:04:01 +00:00
|
|
|
}
|
2020-06-11 16:03:43 +00:00
|
|
|
create_custom_fields(custom_fields, update=update)
|
2019-01-17 19:04:01 +00:00
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2019-01-17 19:04:01 +00:00
|
|
|
def add_print_formats():
|
|
|
|
frappe.reload_doc("regional", "print_format", "irs_1099_form")
|
2021-03-03 11:33:48 +00:00
|
|
|
frappe.db.set_value("Print Format", "IRS 1099 Form", "disabled", 0)
|