[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 164b8ed01a 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
This commit is contained in:
@@ -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)+"]");
|
||||
|
||||
Reference in New Issue
Block a user