In the OpenERP 7 list view, I want to show the sorting of the status value in the draft order, assign and cancel now in Asc or Desc. But in my case, we need sorting in the draft order, assignment and cancellation of the state. Based on applied in order in python file
For example, in SQL code -
select state, date from object_name ORDER BY CASE WHEN state = 'draft' THEN 0 WHEN state = 'assigned' THEN 1 WHEN state = 'cancel' THEN 2 ELSE 3 END, date desc
The above sql code used in python
_order = ("CASE WHEN state='draft' THEN 0", "WHEN state = 'assigned' THEN 1", "ELSE 2 END, date desc")
In the above selection of the sort selection value working in pg_admin, but in python code it shows an error below
Invalid "order" specified. A valid "order" specification is a comma-separated list of valid field names (optionally followed by asc/desc for the direction)
Based on this sort order by selection value, how to apply in OpenERP? The re-search method also applied the same SQL query, but shows the same problem.
source share