mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-11 13:41:47 +00:00
fix(postgres): pricing rule priority order diverges on Postgres
_get_pricing_rules orders by priority desc; get_pricing_rules then reads
pricing_rules[0].has_priority. priority is a Select (varchar): unset is '' on
MariaDB but NULL on Postgres, which sorts to the top under DESC and flips the
selection. Order by coalesce(priority, '') desc so the unset value sorts last
('' is the text minimum) on both backends.
This commit is contained in:
@@ -152,7 +152,7 @@ def _get_pricing_rules(apply_on, args, values):
|
||||
and {child_doc}.parent = `tabPricing Rule`.name
|
||||
and `tabPricing Rule`.disable = 0 and
|
||||
`tabPricing Rule`.{transaction_type} = 1 {warehouse_cond} {conditions}
|
||||
order by `tabPricing Rule`.priority desc,
|
||||
order by coalesce(`tabPricing Rule`.priority, '') desc,
|
||||
`tabPricing Rule`.name desc""".format(
|
||||
child_doc=child_doc,
|
||||
apply_on_field=apply_on_field,
|
||||
|
||||
Reference in New Issue
Block a user