From f37d5f188efa83cfdacb14ea7acd5a54d746ecd7 Mon Sep 17 00:00:00 2001 From: Diptanil Saha Date: Fri, 13 Jun 2025 12:38:04 +0530 Subject: [PATCH] fix: company validation for accounts on item tax template (#47964) * fix: company validation for accounts on item tax template * fix: syntax error --- .../doctype/item_tax_template/item_tax_template.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/item_tax_template/item_tax_template.py b/erpnext/accounts/doctype/item_tax_template/item_tax_template.py index 02b7455fb9c..464fb0f8227 100644 --- a/erpnext/accounts/doctype/item_tax_template/item_tax_template.py +++ b/erpnext/accounts/doctype/item_tax_template/item_tax_template.py @@ -39,7 +39,16 @@ class ItemTaxTemplate(Document): check_list = [] for d in self.get("taxes"): if d.tax_type: - account_type = frappe.get_cached_value("Account", d.tax_type, "account_type") + account_type, account_company = frappe.get_cached_value( + "Account", d.tax_type, ["account_type", "company"] + ) + + if account_company != self.company: + frappe.throw( + _("Item Tax Row {0}: Account must belong to Company - {1}").format( + d.idx, frappe.bold(self.company) + ) + ) if account_type not in [ "Tax",