[FIX] website_sale_delivery: selection at first rendering

- Set up as a shipper with the highest priority one which will cause an
  error (e.g. service not available for customer address)
- Order a product on eCommerce, go to Payment page

Nothing prevents to click on the 'Pay Now' button, although the shipper
rating has failed. Moreover, the error is not displayed in the label of
the shipper.

Workaround: we force a click on the selected default shipper to trigger
the update. The good solution would probably be to have a completely
dynamic shipper rating integration, instead of some processing at first
rendering and then extra dynamic processing.

opw-1838765
This commit is contained in:
Nicolas Martinelli
2018-05-23 13:17:15 +02:00
committed by Nicolas Martinelli
parent 04dd688091
commit 0b412c250a
2 changed files with 7 additions and 1 deletions
@@ -77,7 +77,7 @@ tour.register('shop_buy_product', {
content: "Pay Now",
//Either there are multiple payment methods, and one is checked, either there is only one, and therefore there are no radio inputs
extra_trigger: '#payment_method label:contains("Wire Transfer") input:checked,#payment_method:not(:has("input:radio:visible"))',
trigger: 'button[id="o_payment_form_pay"]:visible',
trigger: 'button[id="o_payment_form_pay"]:visible:not(:disabled)',
},
{
content: "finish",
@@ -44,6 +44,12 @@ odoo.define('website_sale_delivery.checkout', function (require) {
var $carriers = $("#delivery_carrier input[name='delivery_type']");
$carriers.click(_onCarrierClick);
// Workaround to:
// - update the amount/error on the label at first rendering
// - prevent clicking on 'Pay Now' if the shipper rating fails
if ($carriers.length > 0) {
$carriers.filter(':checked').click();
}
/* Handle stuff */
$(".oe_website_sale select[name='shipping_id']").on('change', function () {