feat: add support for 'not applicable' tax in item tax templates (#50898)

* feat: add support for 'not applicable' tax in item tax templates

* refactor: remove unused imports

* fix: import NOT_APPLICABLE_TAX in get_item_tax_map function

* fix: add item wise tax details for not applicable taxes

* test: added test case for `not_applicable`

* fix: do not create item wise tax details for not applicable tax

* fix: ensure tax rate is set to 0 for not applicable tax rows

* refactor: changes as per review

* test: update selling settings

* test: correct settings

* fix: return both net and current tax amounts for not applicable tax

(cherry picked from commit 453fe376ab)
This commit is contained in:
Lakshit Jain
2026-04-18 11:34:36 +05:30
committed by Mergify
parent de66fd0c58
commit 52a4ca9c41
11 changed files with 331 additions and 16 deletions

View File

@@ -9,7 +9,7 @@ from frappe.utils import cint, flt, get_time, now_datetime
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_dimensions
from erpnext.controllers.status_updater import StatusUpdater
from erpnext.stock.get_item_details import get_item_details
from erpnext.stock.get_item_details import NOT_APPLICABLE_TAX, get_item_details
from erpnext.stock.utils import get_incoming_rate
@@ -367,6 +367,9 @@ class TransactionBase(StatusUpdater):
):
item_tax_template = frappe.json.loads(item_details.item_tax_rate)
for tax_head, _rate in item_tax_template.items():
if _rate == NOT_APPLICABLE_TAX:
continue
found = [x for x in self.taxes if x.account_head == tax_head]
if not found:
self.append("taxes", {"charge_type": "On Net Total", "account_head": tax_head, "rate": 0})