From 012c9a09168c849e4e2282094d56bf3a57deaf1c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 19 May 2017 12:30:58 +0530 Subject: [PATCH] Set default account in mode-of-payment Cash, only if default cash account exists (#8909) --- erpnext/setup/doctype/company/company.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 9f355f7ee9..39ad556227 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -170,7 +170,8 @@ class Company(Document): def set_mode_of_payment_account(self): cash = frappe.db.get_value('Mode of Payment', {'type': 'Cash'}, 'name') - if cash and not frappe.db.get_value('Mode of Payment Account', {'company': self.name}): + if cash and self.default_cash_account \ + and not frappe.db.get_value('Mode of Payment Account', {'company': self.name}): mode_of_payment = frappe.get_doc('Mode of Payment', cash) mode_of_payment.append('accounts', { 'company': self.name,