summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorRomain Derie <rde@odoo.com>2020-02-21 13:22:37 +0000
committerRomain Derie <rde@odoo.com>2020-02-21 13:38:37 +0000
commit601795ba4e0255765a029ae38583a8dfcb648475 (patch)
tree9f5abe05e06862c62835691e5029ff1d0043768f /addons
parent3c9e0b847c86e3d5900e7a2f0f0c6edfa923d685 (diff)
[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>
Diffstat (limited to 'addons')
-rw-r--r--addons/website_sale/controllers/main.py2
-rw-r--r--addons/website_sale/views/templates.xml2
2 files changed, 2 insertions, 2 deletions
diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py
index db106f9bf15..1269580d479 100644
--- a/addons/website_sale/controllers/main.py
+++ b/addons/website_sale/controllers/main.py
@@ -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,
diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml
index cceeb6e689f..f6595be4b37 100644
--- a/addons/website_sale/views/templates.xml
+++ b/addons/website_sale/views/templates.xml
@@ -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>