minor fixes

This commit is contained in:
Subin Tom 2021-09-29 13:34:50 +05:30
parent d3bb920e71
commit 254b20bc09

View File

@ -39,10 +39,10 @@ class TaxJarSettings(Document):
frappe.enqueue('erpnext.regional.united_states.setup.add_product_tax_categories', now=False)
elif fields_already_exist and fields_hidden:
toggle_tax_category_fields('1')
toggle_tax_category_fields(hidden='1')
elif not TAXJAR_CREATE_TRANSACTIONS and not TAXJAR_CALCULATE_TAX and not TAXJAR_SANDBOX_MODE:
toggle_tax_category_fields('0')
else:
toggle_tax_category_fields(hidden='0')
@frappe.whitelist()
def update_nexus_list(self):
@ -55,9 +55,9 @@ class TaxJarSettings(Document):
self.set('nexus', new_nexus_list)
self.save()
def toggle_tax_category_fields(toggle):
frappe.set_value('Custom Field',{'dt':'Sales Invoice Item', 'fieldname':'product_tax_category'},'hidden',toggle)
frappe.set_value('Custom Field',{'dt':'Item', 'fieldname':'product_tax_category'},'hidden',toggle)
def toggle_tax_category_fields(hidden):
frappe.set_value('Custom Field',{'dt':'Sales Invoice Item', 'fieldname':'product_tax_category'},'hidden',hidden)
frappe.set_value('Custom Field',{'dt':'Item', 'fieldname':'product_tax_category'},'hidden',hidden)
def add_product_tax_categories():
@ -67,14 +67,12 @@ def add_product_tax_categories():
def create_tax_categories(data):
for d in data:
tax_category = frappe.new_doc('Product Tax Category')
tax_category.description = d.get("description")
tax_category.product_tax_code = d.get("product_tax_code")
tax_category.category_name = d.get("name")
try:
if not frappe.db.exists('Product Tax Category',{'product_tax_code':d.get('product_tax_code')}):
tax_category = frappe.new_doc('Product Tax Category')
tax_category.description = d.get("description")
tax_category.product_tax_code = d.get("product_tax_code")
tax_category.category_name = d.get("name")
tax_category.db_insert()
except frappe.DuplicateEntryError:
pass
def make_custom_fields(update=True):
custom_fields = {