From a62f4c30d95da9bd962bd5c900c715b4d1d65b6e Mon Sep 17 00:00:00 2001 From: "Abdelouahab (abla)" Date: Mon, 18 Dec 2023 10:22:30 +0100 Subject: [PATCH] [FIX] website_sale: check pickUp list To reproduce ============ - Website > Shipping methods > Pick-up in store - Add a description displayed on the eCommerce - add at least 3 or 4 lines with "enter" in between the lines. - from the shop select Pick-up in store, the payment button will be locked Problem ======= - The method `_disablePayButtonNoPickupPoint` checks if there are pickup points in a shipping method based on the count of children in the selected method - The description will be counted as child which breaks the checking Solution ======== check the existence of `.o_list_pickup_locations` instead opw-3628025 closes odoo/odoo#149163 X-original-commit: cfaa0d47de2b4931f23994061ec489ae5705f181 Signed-off-by: Antoine Vandevenne (anv) Signed-off-by: Abdelouahab Laaroussi (abla) --- addons/website_sale/static/src/js/website_sale_delivery.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/website_sale/static/src/js/website_sale_delivery.js b/addons/website_sale/static/src/js/website_sale_delivery.js index 11b5b678c21..53cd0b383ff 100644 --- a/addons/website_sale/static/src/js/website_sale_delivery.js +++ b/addons/website_sale/static/src/js/website_sale_delivery.js @@ -205,11 +205,12 @@ publicWidget.registry.websiteSaleDelivery = publicWidget.Widget.extend({ _disablePayButtonNoPickupPoint : function (ev){ const selectedCarrierEl = ev.currentTarget.closest('.o_delivery_carrier_select'); const address = selectedCarrierEl.querySelector('.o_order_location_address').innerText - const isPickUp = selectedCarrierEl.lastChild.previousSibling.children; + const orderLocationContainer = selectedCarrierEl.querySelector('.o_order_location').parentNode; + const hasPickUpLocations = selectedCarrierEl.querySelector('.o_list_pickup_locations'); document.querySelectorAll('.error_no_pick_up_point').forEach(el => el.remove()); - if (isPickUp.length > 1 && (address == "" || isPickUp[0].classList.contains("d-none"))) { + if (hasPickUpLocations && (address == "" || orderLocationContainer.classList.contains("d-none"))) { this._disablePayButton(); const errorNode = document.createElement("i"); errorNode.classList.add("small", "error_no_pick_up_point","ms-2");