Odoo Help


Can a field added through Manage Views be made sortable?

Jeff Beidler
on 10/16/14, 2:43 PM 1,131 views

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?

Alan Bell
On 1/20/16, 6:04 AM

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


Techno-Functional Associate with 7+ years of experience in Odoo (formerly known as OpenERP).

On 10/17/14, 1:22 AM

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

Libertus Solutions, Alan Bell
on 1/20/16, 6:05 AM

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.


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)


Asked: 10/16/14, 2:43 PM
Seen: 1131 times
Last updated: 1/20/16, 6:04 AM