跳至内容
菜单
此问题已终结
2 回复
3047 查看

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

Thanks!!

形象
丢弃
最佳答案

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

形象
丢弃
最佳答案

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

形象
丢弃

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

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