[fix] make setup_wizard.create_bank_account multi-company safe

This commit is contained in:
Rushabh Mehta
2016-01-18 12:35:00 +05:30
parent 0e2f9ee44c
commit 34fb5cf0e2
14 changed files with 1724 additions and 431 deletions

View File

@@ -112,15 +112,17 @@ def create_fiscal_year_and_company(args):
def create_bank_account(args):
if args.get("bank_account"):
company_name = args.get('company_name').strip()
bank_account_group = frappe.db.get_value("Account",
{"account_type": "Bank", "is_group": 1, "root_type": "Asset"})
{"account_type": "Bank", "is_group": 1, "root_type": "Asset",
"company": company_name})
if bank_account_group:
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(),
'company': company_name,
"account_type": "Bank",
})
try: