blob: 808bbb1a6934ceec5f695de02a509b160006a907 [file] [log] [blame]
Tyler Matteson53a64922019-01-17 14:04:01 -05001# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
2# License: GNU General Public License v3. See license.txt
3
Tyler Matteson53a64922019-01-17 14:04:01 -05004import frappe
5from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
6
Ankush Menat494bd9e2022-03-28 18:52:46 +05307
Tyler Matteson53a64922019-01-17 14:04:01 -05008def setup(company=None, patch=True):
Subin Tom70049442021-08-31 18:33:16 +05309 # Company independent fixtures should be called only once at the first company setup
Ankush Menat494bd9e2022-03-28 18:52:46 +053010 if frappe.db.count("Company", {"country": "United States"}) <= 1:
Subin Tom70049442021-08-31 18:33:16 +053011 setup_company_independent_fixtures(patch=patch)
12
Ankush Menat494bd9e2022-03-28 18:52:46 +053013
Subin Tom70049442021-08-31 18:33:16 +053014def setup_company_independent_fixtures(company=None, patch=True):
Tyler Matteson53a64922019-01-17 14:04:01 -050015 make_custom_fields()
16 add_print_formats()
Tyler Matteson53a64922019-01-17 14:04:01 -050017
Ankush Menat494bd9e2022-03-28 18:52:46 +053018
Deepesh Garg9df45322020-06-11 21:33:43 +053019def make_custom_fields(update=True):
Tyler Matteson53a64922019-01-17 14:04:01 -050020 custom_fields = {
Ankush Menat494bd9e2022-03-28 18:52:46 +053021 "Supplier": [
22 dict(
23 fieldname="irs_1099",
24 fieldtype="Check",
25 insert_after="tax_id",
26 label="Is IRS 1099 reporting required for supplier?",
27 )
vishdhad3ec1c12020-03-24 11:31:41 +053028 ],
Ankush Menat494bd9e2022-03-28 18:52:46 +053029 "Sales Order": [
30 dict(
31 fieldname="exempt_from_sales_tax",
32 fieldtype="Check",
33 insert_after="taxes_and_charges",
34 label="Is customer exempted from sales tax?",
35 )
vishdhad3ec1c12020-03-24 11:31:41 +053036 ],
Ankush Menat494bd9e2022-03-28 18:52:46 +053037 "Sales Invoice": [
38 dict(
39 fieldname="exempt_from_sales_tax",
40 fieldtype="Check",
41 insert_after="taxes_section",
42 label="Is customer exempted from sales tax?",
43 )
vishdhad3ec1c12020-03-24 11:31:41 +053044 ],
Ankush Menat494bd9e2022-03-28 18:52:46 +053045 "Customer": [
46 dict(
47 fieldname="exempt_from_sales_tax",
48 fieldtype="Check",
Nabin Haitfb7ee302022-11-09 17:50:36 +053049 insert_after="dn_required",
Ankush Menat494bd9e2022-03-28 18:52:46 +053050 label="Is customer exempted from sales tax?",
51 )
vishdhad3ec1c12020-03-24 11:31:41 +053052 ],
Ankush Menat494bd9e2022-03-28 18:52:46 +053053 "Quotation": [
54 dict(
55 fieldname="exempt_from_sales_tax",
56 fieldtype="Check",
57 insert_after="taxes_and_charges",
58 label="Is customer exempted from sales tax?",
59 )
60 ],
Tyler Matteson53a64922019-01-17 14:04:01 -050061 }
Deepesh Garg9df45322020-06-11 21:33:43 +053062 create_custom_fields(custom_fields, update=update)
Tyler Matteson53a64922019-01-17 14:04:01 -050063
Ankush Menat494bd9e2022-03-28 18:52:46 +053064
Tyler Matteson53a64922019-01-17 14:04:01 -050065def add_print_formats():
66 frappe.reload_doc("regional", "print_format", "irs_1099_form")
barredterra1521b312021-03-03 12:33:48 +010067 frappe.db.set_value("Print Format", "IRS 1099 Form", "disabled", 0)