Fix error msg (#15146)
diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py
index cc33c54..3db7402 100644
--- a/erpnext/accounts/doctype/account/account.py
+++ b/erpnext/accounts/doctype/account/account.py
@@ -207,10 +207,13 @@
@frappe.whitelist()
def update_account_number(name, account_name, account_number=None):
- account = frappe.db.get_value("Account", name, ["company"], as_dict=True)
+ account = frappe.db.get_value("Account", name, "company", as_dict=True)
+ if not account: return
validate_account_number(name, account_number, account.company)
if account_number:
frappe.db.set_value("Account", name, "account_number", account_number.strip())
+ else:
+ frappe.db.set_value("Account", name, "account_number", "")
frappe.db.set_value("Account", name, "account_name", account_name.strip())
new_name = get_account_autoname(account_number, account_name, account.company)