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

I can not able to sort country_states in alphabectically A-Z sorting, I have tried lambda python sorting, but I cannot overwrite its default sorting which is by state code.

I can able to sort countries name by python lambda sorting . Here is the code of country_states selection. Please kindly help.

形象
丢弃
最佳答案

Inherit res.country.state model and change change the order attribute like this

class CountryState(models.Model):    
    _inherit = 'res.country.state'
    _order = 'name asc, code asc'
形象
丢弃
相关帖文 回复 查看 活动
2
10月 22
4837
1
6月 25
1457
3
7月 25
3152
1
5月 25
1283
1
5月 25
1560