[FIX] website_sale: load states according to address mode
Step to reproduce:
- Install delivery and restrict your delivery to a few states
- Edit an already existing shipping address in checkout which is set to a
country having restricted states in the delivery method
- The states listed in the address shipping page are not the restricted ones
but all states.
Related to #26530
closes odoo/odoo#45948
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
@@ -716,8 +716,8 @@ class WebsiteSale(http.Controller):
|
||||
'checkout': values,
|
||||
'can_edit_vat': can_edit_vat,
|
||||
'country': country,
|
||||
'country_states': country.get_website_sale_states(mode=mode[1]),
|
||||
'countries': country.get_website_sale_countries(mode=mode[1]),
|
||||
"states": country.get_website_sale_states(mode=mode[1]),
|
||||
'error': errors,
|
||||
'callback': kw.get('callback'),
|
||||
'only_services': order and order.only_services,
|
||||
|
||||
@@ -1254,7 +1254,7 @@
|
||||
<label class="col-form-label" for="state_id">State / Province</label>
|
||||
<select name="state_id" t-attf-class="form-control #{error.get('state_id') and 'is-invalid' or ''}" data-init="1">
|
||||
<option value="">State / Province...</option>
|
||||
<t t-foreach="country and country.state_ids or []" t-as="s">
|
||||
<t t-foreach="country_states" t-as="s">
|
||||
<option t-att-value="s.id" t-att-selected="s.id == ('state_id' in checkout and country and checkout['state_id'] != '' and int(checkout['state_id']))">
|
||||
<t t-esc="s.name" />
|
||||
</option>
|
||||
|
||||
Reference in New Issue
Block a user