From 48413b07789087fc65109e54cd22a34d0204cbc4 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Fri, 18 Nov 2022 02:22:43 +0530 Subject: [PATCH] fix: reduce function call --- erpnext/accounts/doctype/account/account.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py index 7b1ce0de041..ec0ba081c8b 100644 --- a/erpnext/accounts/doctype/account/account.py +++ b/erpnext/accounts/doctype/account/account.py @@ -380,13 +380,11 @@ def validate_account_number(name, account_number, company): @frappe.whitelist() def update_account_number(name, account_name, account_number=None, from_descendant=False): - account = frappe.get_cached_value("Account", name, "company", as_dict=True) + account = frappe.get_cached_doc("Account", name) if not account: return - old_acc_name, old_acc_number = frappe.get_cached_value( - "Account", name, ["account_name", "account_number"] - ) + old_acc_name, old_acc_number = account.account_name, account.account_number # check if account exists in parent company ancestors = get_ancestors_of("Company", account.company)