[FIX] website_sale: usability fixes in the checkout/address form
* `disabled` on the country select tag instead of `readonly` * `create a new address` selected when the user set an invalid shipping address and must correct it. Else the user was correcting the shipping address but the option "ship to the same address" was selected.
This commit is contained in:
parent
a644bbaec8
commit
a03e5c42ec
|
@ -7,10 +7,12 @@ $('.oe_website_sale').each(function () {
|
|||
var value = +$shippingDifferent.val();
|
||||
var data = $shippingDifferent.find("option:selected").data();
|
||||
var $snipping = $(".js_shipping", oe_website_sale);
|
||||
var $inputs = $snipping.find("input,select");
|
||||
var $inputs = $snipping.find("input");
|
||||
var $selects = $snipping.find("select");
|
||||
|
||||
$snipping.toggle(!!value);
|
||||
$inputs.attr("readonly", value <= 0 ? null : "readonly" ).prop("readonly", value <= 0 ? null : "readonly" );
|
||||
$selects.attr("disabled", value <= 0 ? null : "disabled" ).prop("disabled", value <= 0 ? null : "disabled" );
|
||||
|
||||
$inputs.each(function () {
|
||||
$(this).val( data[$(this).attr("name")] || "" );
|
||||
|
|
|
@ -921,7 +921,7 @@
|
|||
t-att-data-shipping_country_id="shipping.country_id and shipping.country_id.id"
|
||||
><t t-esc="', '.join('\n'.join(shipping.name_get()[0][1].split(',')).split('\n')[1:])"/></option>
|
||||
</t>
|
||||
<option value="-1">-- Create a new address --</option>
|
||||
<option value="-1" t-att-selected="error and len(error) > 0 and shipping_id == -1">-- Create a new address --</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -951,7 +951,7 @@
|
|||
</div>
|
||||
<div t-attf-class="form-group #{error.get('shipping_country_id') and 'has-error' or ''} col-lg-6">
|
||||
<label class="control-label" for="shipping_country_id">Country</label>
|
||||
<select name="shipping_country_id" class="form-control" t-att-readonly=" 'readonly' if shipping_id >= 0 else ''">
|
||||
<select name="shipping_country_id" class="form-control" t-att-disabled=" 'disabled' if shipping_id >= 0 else ''">
|
||||
<option value="">Country...</option>
|
||||
<t t-foreach="countries or []" t-as="country">
|
||||
<option t-att-value="country.id" t-att-selected="country.id == checkout.get('shipping_country_id')"><t t-esc="country.name"/></option>
|
||||
|
|
Loading…
Reference in New Issue