perf: use get_cached_value instead of db.get_value in accounts module

This commit is contained in:
Daizy Modi
2022-11-03 13:38:48 +05:30
parent 7a5a500d29
commit 27df455b98
33 changed files with 101 additions and 90 deletions

View File

@@ -174,7 +174,7 @@ def get_gl_entries(filters, accounting_dimensions):
order_by_statement = "order by account, posting_date, creation"
if filters.get("include_default_book_entries"):
filters["company_fb"] = frappe.db.get_value(
filters["company_fb"] = frappe.get_cached_value(
"Company", filters.get("company"), "default_finance_book"
)
@@ -287,7 +287,7 @@ def get_accounts_with_children(accounts):
all_accounts = []
for d in accounts:
if frappe.db.exists("Account", d):
lft, rgt = frappe.db.get_value("Account", d, ["lft", "rgt"])
lft, rgt = frappe.get_cached_value("Account", d, ["lft", "rgt"])
children = frappe.get_all("Account", filters={"lft": [">=", lft], "rgt": ["<=", rgt]})
all_accounts += [c.name for c in children]
else: