fix: stock module not opened when no warehouses

This commit is contained in:
Rohit Waghchaure
2026-01-13 17:02:39 +05:30
parent ccb4b1fbc4
commit 9de3b07223

View File

@@ -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 = []