fix: use doc_before_save and other changes

This commit is contained in:
Sagar Vora
2022-11-18 01:53:24 +05:30
parent fdfe5cbf93
commit 8ae58ed427
2 changed files with 37 additions and 40 deletions

View File

@@ -286,10 +286,10 @@ def get_accounts_with_children(accounts):
all_accounts = []
for d in accounts:
account_data = frappe.get_cached_value("Account", d, ["lft", "rgt"], as_dict=1)
if account_data:
account = frappe.get_cached_doc("Account", d)
if account:
children = frappe.get_all(
"Account", filters={"lft": [">=", account_data.lft], "rgt": ["<=", account_data.rgt]}
"Account", filters={"lft": [">=", account.lft], "rgt": ["<=", account.rgt]}
)
all_accounts += [c.name for c in children]
else: