fix: TaxJar update - nexus, selective api call

This commit is contained in:
Subin Tom
2021-09-14 20:42:47 +05:30
parent df3e4ce1c0
commit b01fe1c3e2
7 changed files with 114 additions and 5 deletions

View File

@@ -164,6 +164,11 @@ def set_sales_tax(doc, method):
setattr(doc, "taxes", [tax for tax in doc.taxes if tax.account_head != TAX_ACCOUNT_HEAD])
return
# check if delivering within a nexus
nexus_list = frappe.get_doc('TaxJar Settings').get("nexus")
if tax_dict["to_state"] not in [nex.region_code for nex in nexus_list]:
return
tax_data = validate_tax_request(tax_dict)
if tax_data is not None:
if not tax_data.amount_to_collect: