From f3254c201000a822dab2dde2b6340f04051cbd4a Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 29 Dec 2023 16:16:02 +0530 Subject: [PATCH] fix: Validate account in Sales/Purchase Taxes and Charges Template (#39013) fix: Validate account in Sales/Purchase Taxes and Charges Template (#39013) (cherry picked from commit cd37fd790b9d7a28b9df8697c9b40c5477a580ec) Co-authored-by: Deepesh Garg --- erpnext/controllers/accounts_controller.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 9e4abff6b477..4aa8e86f3178 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -2398,6 +2398,7 @@ def validate_taxes_and_charges(tax): def validate_account_head(idx, account, company, context=""): account_company = frappe.get_cached_value("Account", account, "company") + is_group = frappe.get_cached_value("Account", account, "is_group") if account_company != company: frappe.throw( @@ -2407,6 +2408,12 @@ def validate_account_head(idx, account, company, context=""): title=_("Invalid Account"), ) + if is_group: + frappe.throw( + _("Row {0}: Account {1} is a Group Account").format(idx, frappe.bold(account)), + title=_("Invalid Account"), + ) + def validate_cost_center(tax, doc): if not tax.cost_center: