From 55cb91ce2098699b10ff74e0306f8e78c073730e Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 8 Apr 2025 17:35:45 +0530 Subject: [PATCH] refactor: use meta to identify tree --- erpnext/controllers/budget_controller.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/budget_controller.py b/erpnext/controllers/budget_controller.py index 8d4209d5833..bf54e148252 100644 --- a/erpnext/controllers/budget_controller.py +++ b/erpnext/controllers/budget_controller.py @@ -105,7 +105,7 @@ class BudgetValidation: budget_against = frappe.scrub(_bud.budget_against) dimension = _bud.get(budget_against) - if frappe.db.get_value(_bud.budget_against, dimension, "is_group"): + if _bud.is_tree and frappe.db.get_value(_bud.budget_against, dimension, "is_group"): child_nodes = self.get_child_nodes(_bud.budget_against, dimension) for child in child_nodes: key = (budget_against, child[0], _bud.account) @@ -179,6 +179,10 @@ class BudgetValidation: query = query.select(bud[x.get("fieldname")]) _budgets = query.run(as_dict=True) + + for x in _budgets: + x.is_tree = frappe.get_meta(x.budget_against).is_tree + return _budgets def get_ordered_amount(self, key: tuple | None = None):