Odoo Help


Order by ASC or DESC in openerp

Nanie BE
on 11/5/14, 2:40 AM 16,198 views



how to order by ASC OR DESC  a field in a view form in openerp?



Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
| 5 5 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 11/5/14, 2:58 AM

_order: (https://doc.odoo.com/6.0/developer/2_5_Objects_Fields_Methods/object_attributes/)
Name of the fields used to sort the results of the search and read methods.

Default value: 'id'.

_order = "name"
_order = "date_order desc"

Also, it can be ordered with multiple fields also.
_order = "name, date_order desc"



Will it automatically be ordered in the form view?

Nanie BE
on 11/5/14, 3:34 AM

yes. when Odoo tries to load the record, it will check whether the table contain any _order available with it. If value is set, then records are loaded sequentially according to your field set at _order

Atchuthan - Technical Consultant, Sodexis Inc
on 11/5/14, 4:35 AM

i dont need any order. can we workout like that?

on 6/19/17, 12:24 AM
Mohamed Magdy
On 11/5/14, 2:52 AM

you can add to your model class

    _order = 'FIELD_NAME asc'


    _order = 'FIELD_NAME desc'

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

1 follower(s)


Asked: 11/5/14, 2:40 AM
Seen: 16198 times
Last updated: 6/1/15, 2:11 PM