Skip to Content
Menu
This question has been flagged
1 Reply
1157 Views

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.

Avatar
Discard
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'
Avatar
Discard
Related Posts Replies Views Activity
2
Oct 22
3123
2
Dec 24
3141
1
Dec 24
363
4
Nov 24
1370
1
Sep 24
1139