Hello everybody!!!
I want to order my view tree.
SO that, i tried the key 'default_order'.
Here is what i tried:
My Python class:
class test_momo(models.Model):
_name = "test.momo"
_order = 'temps_attente asc,id'
and in my view tree:
<record id="test_momo_tree" model="ir.ui.view">
<field name="name">test.momo.tree</field>
<field name="model">test.momo</field>
<field name="arch" type="xml">
<tree string="Request" default_order='temps_attente desc' colors="red:state=='refuse'; orange:state=='validate1'; green:state=='validate'">
<field name="employee_id"/>
<field name="request_date"/>
<field name="state"/>
</tree>
</field>
</record>
But i haven' got anything.
Hi just add like this in python file only,
_order = "field_name desc"
or
_order = "field_name asc"
I'm not sure if you can give asc or desc in xml, but default_order in tree view should work.