mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 04:09:11 +00:00
fix: validated cost center in financial_statement (#18733)
* fix: validated cost center in financial_statement * Update financial_statements.py
This commit is contained in:
committed by
Nabin Hait
parent
0df513434e
commit
bc5712a1b3
@@ -425,9 +425,12 @@ def get_cost_centers_with_children(cost_centers):
|
|||||||
|
|
||||||
all_cost_centers = []
|
all_cost_centers = []
|
||||||
for d in cost_centers:
|
for d in cost_centers:
|
||||||
lft, rgt = frappe.db.get_value("Cost Center", d, ["lft", "rgt"])
|
if frappe.db.exists("Cost Center", d):
|
||||||
children = frappe.get_all("Cost Center", filters={"lft": [">=", lft], "rgt": ["<=", rgt]})
|
lft, rgt = frappe.db.get_value("Cost Center", d, ["lft", "rgt"])
|
||||||
all_cost_centers += [c.name for c in children]
|
children = frappe.get_all("Cost Center", filters={"lft": [">=", lft], "rgt": ["<=", rgt]})
|
||||||
|
all_cost_centers += [c.name for c in children]
|
||||||
|
else:
|
||||||
|
frappe.throw(_("Cost Center: {0} does not exist".format(d)))
|
||||||
|
|
||||||
return list(set(all_cost_centers))
|
return list(set(all_cost_centers))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user