mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-19 17:30:01 +00:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user