blob: db6a9c35475c622020ee39f90ddbec4a3dd467d0 [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
Subin Tom70049442021-08-31 18:33:16 +05305import os
6import json
7from frappe.permissions import add_permission, update_permission_property
Tyler Matteson53a64922019-01-17 14:04:01 -05008from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
9
Tyler Matteson53a64922019-01-17 14:04:01 -050010def setup(company=None, patch=True):
Subin Tom70049442021-08-31 18:33:16 +053011 # Company independent fixtures should be called only once at the first company setup
12 if frappe.db.count('Company', {'country': 'United States'}) <=1:
13 setup_company_independent_fixtures(patch=patch)
14
15def setup_company_independent_fixtures(company=None, patch=True):
Tyler Matteson53a64922019-01-17 14:04:01 -050016 make_custom_fields()
17 add_print_formats()
Tyler Matteson53a64922019-01-17 14:04:01 -050018
Deepesh Garg9df45322020-06-11 21:33:43 +053019def make_custom_fields(update=True):
Tyler Matteson53a64922019-01-17 14:04:01 -050020 custom_fields = {
21 'Supplier': [
22 dict(fieldname='irs_1099', fieldtype='Check', insert_after='tax_id',
23 label='Is IRS 1099 reporting required for supplier?')
vishdhad3ec1c12020-03-24 11:31:41 +053024 ],
25 'Sales Order': [
26 dict(fieldname='exempt_from_sales_tax', fieldtype='Check', insert_after='taxes_and_charges',
27 label='Is customer exempted from sales tax?')
28 ],
29 'Sales Invoice': [
30 dict(fieldname='exempt_from_sales_tax', fieldtype='Check', insert_after='taxes_section',
31 label='Is customer exempted from sales tax?')
32 ],
33 'Customer': [
34 dict(fieldname='exempt_from_sales_tax', fieldtype='Check', insert_after='represents_company',
35 label='Is customer exempted from sales tax?')
36 ],
37 'Quotation': [
38 dict(fieldname='exempt_from_sales_tax', fieldtype='Check', insert_after='taxes_and_charges',
39 label='Is customer exempted from sales tax?')
Tyler Matteson53a64922019-01-17 14:04:01 -050040 ]
41 }
Deepesh Garg9df45322020-06-11 21:33:43 +053042 create_custom_fields(custom_fields, update=update)
Tyler Matteson53a64922019-01-17 14:04:01 -050043
Tyler Matteson53a64922019-01-17 14:04:01 -050044def add_print_formats():
45 frappe.reload_doc("regional", "print_format", "irs_1099_form")
barredterra1521b312021-03-03 12:33:48 +010046 frappe.db.set_value("Print Format", "IRS 1099 Form", "disabled", 0)