fix(stock): group the Stock Ledger opening-balance dimension query

get_opening_balance_for_inv_dimension selected item_code and warehouse alongside Sum() aggregates with no GROUP BY, which PostgreSQL rejects ('column ...item_code must appear in the GROUP BY clause'). Add GROUP BY item_code, warehouse. The query already returns early unless a single item and warehouse is selected, so this stays one row with identical values on MariaDB while becoming valid on Postgres.
This commit is contained in:
Mihir Kandoi
2026-06-23 09:13:51 +05:30
parent bde630b888
commit 16b27ecdd1

View File

@@ -822,6 +822,8 @@ def get_opening_balance_for_inv_dimension(filters, inv_dimension_wise_value):
else:
query = query.where(sl_doctype[key] == value)
query = query.groupby(sl_doctype.item_code, sl_doctype.warehouse)
opening_data = query.run(as_dict=True)
if opening_data: