summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2016-12-27 14:01:40 +0100
committerNicolas Lempereur <nle@odoo.com>2016-12-27 15:44:55 +0100
commitd36dca2d2de8bf51dc9b48d22ab41ab3f52aa82a (patch)
treec3af7d4998a553a9efa2771314f0c2b4346a6656
parentbf88647e8d51285583a39888c1964737b178b07c (diff)
[FIX] website_sale: 2 state tags and same shipping change
If website_sale_delivery is installed, when we choose same invoice address as shipping or another one, a new set of country/state are displayed. It is done since if we are using the invoicing address as shipping, the address must be in the allowed shipping countries and states. This was solved for some instances with 164b8ed01a96 but failed in other instances. With this fix the two state select tags have references to their own options which allow us to have it alright for the several possibilities. opw-693127
-rw-r--r--addons/website_sale/static/src/js/website_sale.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/website_sale/static/src/js/website_sale.js b/addons/website_sale/static/src/js/website_sale.js
index 6114d5e0107..094185c91da 100644
--- a/addons/website_sale/static/src/js/website_sale.js
+++ b/addons/website_sale/static/src/js/website_sale.js
@@ -347,9 +347,12 @@ $('.oe_website_sale').each(function () {
$('input.js_variant_change, select.js_variant_change', this).first().trigger('change');
});
- var state_options = $("select[name='state_id']:visible option:not(:first)");
+ $("select[name='state_id']").each(function(){
+ $(this).data('options', $(this).find('option:not(:first)'));
+ });
$(oe_website_sale).on('change', "select[name='country_id']", function () {
- var select = $("select[name='state_id']:visible");
+ var select = $("select[name='state_id']:enabled");
+ var state_options = select.data('options');
var selected_state = select.val();
state_options.detach();
var displayed_state = state_options.filter("[data-country_id="+($(this).val() || 0)+"]");