fix: reposting patch

This commit is contained in:
Rohit Waghchaure
2021-02-26 17:34:53 +05:30
parent f8a7e000f5
commit c603fd638b
2 changed files with 10 additions and 2 deletions

View File

@@ -38,7 +38,7 @@ def get_warehouse_account_map(company=None):
frappe.flags.warehouse_account_map[company] = warehouse_account
else:
frappe.flags.warehouse_account_map = warehouse_account
return frappe.flags.warehouse_account_map.get(company) or frappe.flags.warehouse_account_map
def get_warehouse_account(warehouse, warehouse_account=None):
@@ -64,6 +64,10 @@ def get_warehouse_account(warehouse, warehouse_account=None):
if not account and warehouse.company:
account = get_company_default_inventory_account(warehouse.company)
if not account and warehouse.company:
account = frappe.db.get_value('Account',
{'account_type': 'Stock', 'is_group': 0, 'company': warehouse.company}, 'name')
if not account and warehouse.company and not warehouse.is_group:
frappe.throw(_("Please set Account in Warehouse {0} or Default Inventory Account in Company {1}")
.format(warehouse.name, warehouse.company))