Skip to Content
Menu
This question has been flagged
2 Replies
1979 Views

Hi guys, I am creating a form with field many2one as customer, how can i sort this field alphabetically?

Thanks!!

Avatar
Discard
Best Answer

Hi,

Here is a forum answer that lets you sort in descending order. Please go through it.

https://www.odoo.com/forum/help-1/how-to-sort-a-many2one-field-in-descending-order-52793

Change the xml

<field name="period_id"  context="{'order_display': 'name desc' }"/> 

To

<field name="period_id"  context="{'order_display': 'name asc ' }"/> 

To sort in ascending order

Regards

Avatar
Discard
Best Answer

Add, context="{'order_display': 'name asc ' }" or context="{'order_display': 'name desc ' }" in xml view fields 

Avatar
Discard

doesn't make sense to repeat the same answer without any thing extra

@Niyas Raphy..Just answered a query nothing much...