CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I've a custom module where _order = 'status desc' is defined. Can we add any condition for applying the _order
Ex: suppose there are 2 tree views present with the same table. (Separated by flag == 1 and flag == 0)
Now I want to apply the _order to the tree view where flag == 1
Please help me on this. Any help would be appreciated.
def _generate_order_by(self, order_spec, query): my_order = "CASE WHEN state='draft' THEN 0 WHEN state = 'assigned' THEN 1 ELSE 2 END, date desc" if order_spec: return super(sale_order, self)._generate_order_by(order_spec, query) + ", " + my_order return " order by " + my_order
About This Community
Odoo Training Center
|Asked: 4/29/14, 1:09 PM|
|Seen: 3811 times|
|Last updated: 1/22/17, 12:58 PM|