Odoo Help


Sort o many2many field

Daniela Strathmann
on 7/11/18, 9:03 AM 243 views

Is there an chance to sort on a many2many field in the picker (selection list where I choose the value) and then in my view? I tried this but it seems not to work ...

market_tag_ids = fields.Many2many('partner.tags', 'partner_tags_market_tag_rel', 'partner_id', 'market_tag_id', string='Market/s', default_order='name, desc')

<field name="market_tag_ids" widget="many2many_tags" attrs="{'invisible': [('is_company', '=', True)]}" options="{'no_create_edit': True}" domain="[('category','=','market')]" default_order="name, asc"/>

Ray Carnes (ray)
On 7/11/18, 3:04 PM

It works when you define an order for the partner.tag model.

_name = 'partner.tags'
_order = "name asc"

Note: fields are separated by a comma, and the ASC or DESC just comes after the field name separated by a space.




Thanky you so much.

Vintage Living, Daniela Strathmann
on 7/11/18, 3:36 PM

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: 7/11/18, 9:03 AM
Seen: 243 times
Last updated: 7/11/18, 3:37 PM