From 9de3b0722390beb73067f1c594c8f2f3ec0369ab Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 13 Jan 2026 17:02:39 +0530 Subject: [PATCH] fix: stock module not opened when no warehouses --- .../stock_value_by_item_group/stock_value_by_item_group.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/dashboard_chart_source/stock_value_by_item_group/stock_value_by_item_group.py b/erpnext/stock/dashboard_chart_source/stock_value_by_item_group/stock_value_by_item_group.py index 68f64619e7b..e2d0b1e41e8 100644 --- a/erpnext/stock/dashboard_chart_source/stock_value_by_item_group/stock_value_by_item_group.py +++ b/erpnext/stock/dashboard_chart_source/stock_value_by_item_group/stock_value_by_item_group.py @@ -53,12 +53,14 @@ def get_stock_value_by_item_group(company): .inner_join(item_doctype) .on(doctype.item_code == item_doctype.name) .select(item_doctype.item_group, stock_value.as_("stock_value")) - .where(doctype.warehouse.isin(warehouses)) .groupby(item_doctype.item_group) .orderby(stock_value, order=frappe.qb.desc) .limit(10) ) + if warehouses: + query = query.where(doctype.warehouse.isin(warehouses)) + results = query.run(as_dict=True) labels = []