Skip to content

Commit

Permalink
fix: Validate account in Sales/Purchase Taxes and Charges Template (#…
Browse files Browse the repository at this point in the history
…39013)

(cherry picked from commit cd37fd7)
  • Loading branch information
deepeshgarg007 authored and mergify[bot] committed Dec 29, 2023
1 parent a2cba1b commit 4f6db80
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions erpnext/controllers/accounts_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2365,6 +2365,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(
Expand All @@ -2374,6 +2375,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:
Expand Down

0 comments on commit 4f6db80

Please sign in to comment.