diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 790003c3010..6864305c44a 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -569,14 +569,18 @@ def get_default_bank_cash_account(company, account_type=None, mode_of_payment=No if account_type=="Bank": account = frappe.db.get_value("Company", company, "default_bank_account") if not account: - account = frappe.db.get_value("Account", - {"company": company, "account_type": "Bank", "is_group": 0}) + account_list = frappe.get_all("Account", filters = {"company": company, + "account_type": "Bank", "is_group": 0}) + if len(account_list) > 0: + account = account_list[0].name elif account_type=="Cash": account = frappe.db.get_value("Company", company, "default_cash_account") if not account: - account = frappe.db.get_value("Account", - {"company": company, "account_type": "Cash", "is_group": 0}) + account_list = frappe.get_all("Account", filters = {"company": company, + "account_type": "Cash", "is_group": 0}) + if len(account_list) > 0: + account = account_list[0].name if account: account_details = frappe.db.get_value("Account", account,