Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
17891 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

There is a default_order attribute

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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>

 

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 5 18
4231
6
thg 9 17
8269
0
thg 6 15
3861
3
thg 6 15
8001
1
thg 3 15
4480