Skip to content

Commit

Permalink
fix: patch fixes- force reload doc, check for company
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesis189 committed Oct 11, 2021
1 parent a183cfc commit 1799b55
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions erpnext/patches/v13_0/custom_fields_for_taxjar_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@

def execute():

frappe.reload_doctype("Taxjar Settings")
company = frappe.get_all('Company', filters = {'country': 'United States'}, fields=['name'])
if not company:
return

frappe.reload_doctype("Taxjar Settings", force=True)

TAXJAR_CREATE_TRANSACTIONS = frappe.db.get_single_value("TaxJar Settings", "taxjar_create_transactions")
TAXJAR_CALCULATE_TAX = frappe.db.get_single_value("TaxJar Settings", "taxjar_calculate_tax")
TAXJAR_SANDBOX_MODE = frappe.db.get_single_value("TaxJar Settings", "is_sandbox")
company = frappe.get_all('Company', filters = {'country': 'United States'}, fields=['name'])

if not company or (not TAXJAR_CREATE_TRANSACTIONS and not TAXJAR_CALCULATE_TAX and not TAXJAR_SANDBOX_MODE):
if (not TAXJAR_CREATE_TRANSACTIONS and not TAXJAR_CALCULATE_TAX and not TAXJAR_SANDBOX_MODE):
return

frappe.reload_doctype("Product Tax Category")
Expand Down

0 comments on commit 1799b55

Please sign in to comment.