fix(postgres): satisfy strict GROUP BY in asset depreciation query

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mihir Kandoi
2026-06-17 16:08:24 +05:30
parent 1efe0be379
commit 59ad76c21e

View File

@@ -96,7 +96,9 @@ def get_depreciable_assets_data(date):
.where(a.status.isin(["Submitted", "Partially Depreciated"]))
.where(ds.journal_entry.isnull())
.where(ds.schedule_date <= date)
.groupby(ads.name)
# a.name/a.creation are constant per ads.name; include them so postgres accepts the
# SELECT and ORDER BY (one row per Asset Depreciation Schedule either way)
.groupby(ads.name, a.name, a.creation)
.orderby(a.creation, order=Order.desc)
)