[minor] fixes reported on support
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index c8ff232..a0ce980 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -300,6 +300,9 @@
account = frappe.db.get_value("Account", self.debit_to,
["account_type", "report_type", "account_currency"], as_dict=True)
+ if not account:
+ frappe.throw(_("Debit To is required"))
+
if account.report_type != "Balance Sheet":
frappe.throw(_("Debit To account must be a Balance Sheet account"))
diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py
index 9892e71..9be2880 100644
--- a/erpnext/setup/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/setup_wizard/setup_wizard.py
@@ -109,20 +109,24 @@
create_bank_account(args)
args["curr_fiscal_year"] = curr_fiscal_year
-
+
def create_bank_account(args):
if args.get("bank_account"):
- bank_account_group = frappe.db.get_value("Account",
+ bank_account_group = frappe.db.get_value("Account",
{"account_type": "Bank", "is_group": 1, "root_type": "Asset"})
if bank_account_group:
- frappe.get_doc({
+ bank_account = frappe.get_doc({
"doctype": "Account",
'account_name': args.get("bank_account"),
'parent_account': bank_account_group,
'is_group':0,
'company':args.get('company_name').strip(),
"account_type": "Bank",
- }).insert()
+ })
+ try:
+ bank_account.insert()
+ except RootNotEditable:
+ frappe.throw(_("Bank account cannot be named as {0}").format(args.get("bank_account")))
def create_price_lists(args):
for pl_type, pl_name in (("Selling", _("Standard Selling")), ("Buying", _("Standard Buying"))):