mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-03 00:23:21 +00:00
The Postgres-portability change added the Purchase Order Item PK (child.name) to get_po_entries' GROUP BY. material_request_item is blank for PO lines not sourced from a Material Request, so a multi-line PO previously collapsed to ONE row per (PO, blank) on MariaDB but now produced one row PER LINE — changing the MariaDB row count (and the add_total_row totals). Group only by (PO, material_request_item) — the pre-effort key — and Max()- aggregate the other selected columns so the query stays valid on Postgres while restoring the prior one-row-per-group MariaDB output (per-column arbitrary→ deterministic, row count preserved). Add a regression test with a two-line PO that fails on the multi-column GROUP BY (2 rows) and passes after (1 row), on both MariaDB and Postgres.