[minor] fixes reported on support

This commit is contained in:
Rushabh Mehta 2016-01-12 11:57:25 +05:30
parent 5dfd1d48fa
commit 659bc1aca4
2 changed files with 11 additions and 4 deletions

View File

@ -300,6 +300,9 @@ class SalesInvoice(SellingController):
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"))

View File

@ -109,20 +109,24 @@ def create_fiscal_year_and_company(args):
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"))):