Is possible to order the line in a one2many without to modify the original class order?
คำถามนี้ถูกตั้งค่าสถานะ
Finally, I found a way to manage this, downloading this module:
https://www.odoo.com/apps/modules/7.0/one2many_sorted/
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(
'res.partner',
'parent_id',
'Contacts',
order='email',
)
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 !! :)
Just add attribute default_order to tree viewdefault_order="date desc"
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อ| Related Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
|---|---|---|---|---|
|
|
0
มี.ค. 15
|
5951 | ||
|
|
0
ก.ย. 17
|
12751 | ||
|
|
1
ม.ค. 25
|
4444 | ||
|
Pre-fill one2many field from action
แก้ไขแล้ว
|
|
2
เม.ย. 24
|
3191 | |
|
|
1
ม.ค. 24
|
4306 |
This could be also useful for open a tree view with a particular order by clause... maybe a context parameter like order_by?
Finally, was it possible? Now I have the same question.