mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-15 23:48:38 +00:00
fix(postgres): expiry-based serial selection picks wrong serials on Postgres
get_serial_nos_based_on_filters with based_on='Expiry' orders by amc_expiry_date asc and limits to qty. MariaDB sorts NULL (no-AMC) serials first; Postgres last, so a different set of serials is auto-selected. Order by (amc_expiry_date IS NULL) desc, amc_expiry_date so NULLs sort first on both (MariaDB unchanged).
This commit is contained in:
@@ -2432,6 +2432,8 @@ def get_serial_nos_based_on_filters(filters, fields, order_by, kwargs):
|
||||
if kwargs.based_on == "LIFO":
|
||||
query = query.orderby(order_by_column, order=frappe.query_builder.Order.desc)
|
||||
else:
|
||||
if order_by == "amc_expiry_date":
|
||||
query = query.orderby(order_by_column.isnull(), order=frappe.query_builder.Order.desc)
|
||||
query = query.orderby(order_by_column)
|
||||
|
||||
for key, value in filters.items():
|
||||
|
||||
Reference in New Issue
Block a user