mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 20:59:11 +00:00
fix: Renamed child table doctype, delete taxes for non nexus state
This commit is contained in:
@@ -42,7 +42,7 @@
|
|||||||
"modified": "2021-09-14 05:33:06.444710",
|
"modified": "2021-09-14 05:33:06.444710",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "ERPNext Integrations",
|
"module": "ERPNext Integrations",
|
||||||
"name": "TaxJar Nexus List",
|
"name": "TaxJar Nexus",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [],
|
"permissions": [],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
@@ -5,5 +5,5 @@
|
|||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
|
|
||||||
class TaxJarNexusList(Document):
|
class TaxJarNexus(Document):
|
||||||
pass
|
pass
|
||||||
@@ -100,13 +100,13 @@
|
|||||||
"fieldname": "nexus",
|
"fieldname": "nexus",
|
||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"label": "Nexus",
|
"label": "Nexus",
|
||||||
"options": "TaxJar Nexus List",
|
"options": "TaxJar Nexus",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-09-14 01:41:55.871028",
|
"modified": "2021-09-16 08:54:48.444487",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "ERPNext Integrations",
|
"module": "ERPNext Integrations",
|
||||||
"name": "TaxJar Settings",
|
"name": "TaxJar Settings",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import frappe
|
|||||||
import taxjar
|
import taxjar
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.contacts.doctype.address.address import get_company_address
|
from frappe.contacts.doctype.address.address import get_company_address
|
||||||
from frappe.utils import cint
|
from frappe.utils import cint, flt
|
||||||
|
|
||||||
from erpnext import get_default_company
|
from erpnext import get_default_company
|
||||||
|
|
||||||
@@ -172,8 +172,7 @@ def set_sales_tax(doc, method):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# check if delivering within a nexus
|
# check if delivering within a nexus
|
||||||
if not frappe.db.get_value('TaxJar Nexus List', {'region_code': tax_dict["to_state"]})
|
check_for_nexus(doc, tax_dict)
|
||||||
return
|
|
||||||
|
|
||||||
tax_data = validate_tax_request(tax_dict)
|
tax_data = validate_tax_request(tax_dict)
|
||||||
if tax_data is not None:
|
if tax_data is not None:
|
||||||
@@ -202,6 +201,17 @@ def set_sales_tax(doc, method):
|
|||||||
|
|
||||||
doc.run_method("calculate_taxes_and_totals")
|
doc.run_method("calculate_taxes_and_totals")
|
||||||
|
|
||||||
|
def check_for_nexus(doc, tax_dict):
|
||||||
|
if not frappe.db.get_value('TaxJar Nexus', {'region_code': tax_dict["to_state"]}):
|
||||||
|
for item in doc.get("items"):
|
||||||
|
item.tax_collectable = flt(0)
|
||||||
|
item.taxable_amount = flt(0)
|
||||||
|
|
||||||
|
for tax in doc.taxes:
|
||||||
|
if tax.account_head == TAX_ACCOUNT_HEAD:
|
||||||
|
doc.taxes.remove(tax)
|
||||||
|
return
|
||||||
|
|
||||||
def check_sales_tax_exemption(doc):
|
def check_sales_tax_exemption(doc):
|
||||||
# if the party is exempt from sales tax, then set all tax account heads to zero
|
# if the party is exempt from sales tax, then set all tax account heads to zero
|
||||||
sales_tax_exempted = hasattr(doc, "exempt_from_sales_tax") and doc.exempt_from_sales_tax \
|
sales_tax_exempted = hasattr(doc, "exempt_from_sales_tax") and doc.exempt_from_sales_tax \
|
||||||
|
|||||||
Reference in New Issue
Block a user