Odoo Help

1

Order by ASC or DESC in openerp

By
Nanie BE
on 11/5/14, 2:40 AM 11,846 views

Hi, 

 

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

Thanks!

2

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
4087
| 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'.

Examples:
_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?

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

you can add to your model class

    _order = 'FIELD_NAME asc'

or

    _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.

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

1 follower(s)

Stats

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