From d662502f3cb7d3d56ef7dd9d8a3ed636d235edef Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 24 Oct 2016 18:17:57 +0530 Subject: [PATCH] [fix] Validate if warehouse is not linked to any account --- erpnext/controllers/stock_controller.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index aa849295f36..e48ca1ace10 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -69,6 +69,10 @@ class StockController(AccountsController): warehouse_with_no_account.append(sle.warehouse) if warehouse_with_no_account: + for wh in warehouse_with_no_account: + if frappe.db.get_value("Warehouse", wh, "company"): + frappe.throw(_("Warehouse {0} is not linked to any account, please create/link the corresponding (Asset) account for the warehouse.").format(wh)) + msgprint(_("No accounting entries for the following warehouses") + ": \n" + "\n".join(warehouse_with_no_account))