Odoo Help

Welcome!

This community 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.

1

How to override " _order" of a module

By
ASP
on 4/29/14, 1:09 PM 2,891 views

Hi All,

I've a custom module where _order = 'status desc' is defined. Can we add any condition for applying the _order

Ex: suppose there are 2 tree views present with the same table. (Separated by flag == 1 and flag == 0)

Now I want to apply the _order to the tree view where flag == 1

Please help me on this. Any help would be appreciated.

Cheers

ASP :)

maybe _order='flag, status desc'

Josse Colpaert (jco)
on 5/1/14, 8:10 AM

Hi Josse,

Did you mean like this : _order = 'flag == 1, status' ?

Cheers

ASP :)

ASP
on 5/2/14, 4:23 AM
0
Soohoo
On 5/5/14, 8:02 AM
def _generate_order_by(self, order_spec, query):
    my_order = "CASE WHEN state='draft'  THEN 0   WHEN state = 'assigned'  THEN 1 ELSE 2 END,  date desc"            
    if order_spec:
        return super(sale_order, self)._generate_order_by(order_spec, query) + ", " + my_order
    return " order by " + my_order

refer Here

Thanks

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 4/29/14, 1:09 PM
Seen: 2891 times
Last updated: 3/16/15, 8:10 AM