Skip to Content
Menu
This question has been flagged
1 Atsakyti
2366 Rodiniai

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.

Portretas
Atmesti
Best Answer

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'
Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
2
spal. 22
5422
1
rugs. 25
2279
1
birž. 25
2302
3
liep. 25
3800
1
geg. 25
1921