Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
3566 มุมมอง

I added a field (Internal Reference) to the Products list view via the GUI interface (Manage Views).  Is it possible to make this field sortable via the GUI, or does it require a custom module?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

This is because of product variants and the tree view is a list of product.product objects (variants), that column is a related field on the product.template (the parent product of the variants), you can't by default sort by related fields, so this problem is quite specific to the internal reference on the products list view.

To fix this you need to write a function called _generate_order_by on the product object (or override the product object to add that function)

There is some discussion of it here including some code for a similar field http://stackoverflow.com/questions/15621013/sorting-openerp-table-by-functional-field/15621014

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

I believe you can add the sort option only in class level, and not GUI level...

อวตาร
ละทิ้ง

nope, it works fine for regular fields, just not functional fields like the default_code field on product.product

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ก.ค. 25
9403
1
พ.ค. 25
1615
0
ม.ค. 24
2229
1
ก.พ. 22
24633
Message attachment size limit แก้ไขแล้ว
5
ธ.ค. 21
17250