跳至內容
選單
此問題已被標幟
1 回覆
2107 瀏覽次數

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
4854
1
6月 25
1488
3
7月 25
3180
1
5月 25
1316
1
5月 25
1582