Odoo Help

0

Can you set order_by in a xml tree view?

By
Eric
on 7/10/14, 1:45 PM 3,934 views

I was wondering if there is a way to set the order_by for a specific tree view in the xml code.  Is there a way to do this?

3
Géry Debongnie (ged)
On 12/22/14, 10:37 AM

There is a default_order attribute

https://www.odoo.com/documentation/8.0/reference/views.html#lists

1
John
On 12/19/14, 2:43 PM

You can do this in your module's action code (or inherit an already existing action). 

Set it in the context with 'order'.  To order it by the Status field for instance (which is 'state' in the database):

 <record id="action_unique_identifier" model="ir.actions.act_window">
             <!-- a bunch of fields -->
            <field name="context">{'order': 'state'}</field>

 

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)

Stats

Asked: 7/10/14, 1:45 PM
Seen: 3934 times
Last updated: 3/16/15, 8:10 AM