Skip to Content
Menu
This question has been flagged
1 Reply
8741 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"/>

Avatar
Discard
Best Answer

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.

 

BEFORE:



AFTER:


Avatar
Discard
Author

Thanky you so much.