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.

0

Can a field added through Manage Views be made sortable?

v8
By
Jeff Beidler
on 10/16/14, 2:43 PM 713 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?

0
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

0

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

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

deep
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

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

1 follower(s)

Stats

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