Odoo Help


Order one2many lines

Francesco OpenCode
on 8/26/13, 1:45 PM 5,910 views

Is possible to order the line in a one2many without to modify the original class order?

This could be also useful for open a tree view with a particular order by clause... maybe a context parameter like order_by?

on 8/26/13, 1:53 PM

Finally, was it possible? Now I have the same question.

Juan Formoso
on 2/5/15, 12:03 PM
Juan Formoso
On 2/6/15, 9:56 AM

Finally, I found a way to manage this, downloading this module:


Then, I overrided the one2many whose order I want to alter, in my case the field was child_ids, and I wanted it to be ordered by email:

'child_ids' : one2many_sorted.one2many_sorted(

Note that the only difference between this field and the one2many is the param order (you can use a couple new more though, search and set).

I also imported the library at the top of the file:

import one2many_sorted

Now, I'm seeing the tree and kanban of res.partner ordered by name, but this one2many is ordered by email. Great!

well done Juan !! :)

on 2/6/15, 10:02 AM

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.


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)


Asked: 8/26/13, 1:45 PM
Seen: 5910 times
Last updated: 5/24/17, 4:53 AM