[FIX] website_sale: show pickup locations if case of 1 shipping method
Issue: ====== When we have 1 delivery method enabled that have pickup locations, it will be selected by default and the pickup locations will never be displayed. Steps to reproduce the issue: ============================= - Set up pickup locations carried for sendcloud (like mondial relay) - Go through the website with just that shipping method available and add a product to cart valid with the configuration of sendcloud. - Go to checkoutout you will get the shipping method selected but no pick up options Origin of the issue: ==================== If the delivery method is already selected it will skip showing pickup locations. Solutions: ========== Now there is another check to make sure that it will be skipped only when the pick up locations are displayed. opw-3569497 closes odoo/odoo#142958 X-original-commit: 7beb8767cd82f2938ffbb53ec496e1f817af8730 Signed-off-by: Steve Van Essche <svs@odoo.com> Signed-off-by: Mahdi Cheikh Rouhou (macr) <macr@odoo.com>
This commit is contained in:
@@ -300,6 +300,16 @@ publicWidget.registry.websiteSaleDelivery = publicWidget.Widget.extend({
|
||||
return true;
|
||||
},
|
||||
|
||||
_isPickupLocationSelected: function (ev) {
|
||||
return !ev.currentTarget.closest('.o_delivery_carrier_select').querySelector(".o_order_location").parentElement.classList.contains("d-none");
|
||||
},
|
||||
|
||||
_shouldDisplayPickupLocations: function (ev) {
|
||||
const pickupPointsAreNeeded = ev.currentTarget.querySelector('.o_show_pickup_locations');
|
||||
const pickupPointsAreDisplayed = ev.currentTarget.querySelector('.o_list_pickup_locations')?.hasChildNodes();
|
||||
return pickupPointsAreNeeded && !pickupPointsAreDisplayed && !this._isPickupLocationSelected(ev);
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Handlers
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -324,7 +334,7 @@ publicWidget.registry.websiteSaleDelivery = publicWidget.Widget.extend({
|
||||
*/
|
||||
_onClickShowLocations: async function (ev) {
|
||||
// This checks if there is a pick up point already select with that carrier
|
||||
if (!ev.currentTarget.closest('.o_delivery_carrier_select').querySelector(".o_order_location").parentElement.classList.contains("d-none")) {
|
||||
if (this._isPickupLocationSelected(ev)) {
|
||||
return;
|
||||
}
|
||||
const showPickupLocations = ev.currentTarget.closest('.o_delivery_carrier_select').querySelector('.o_show_pickup_locations');
|
||||
@@ -373,7 +383,7 @@ publicWidget.registry.websiteSaleDelivery = publicWidget.Widget.extend({
|
||||
_onCarrierClick: async function (ev) {
|
||||
this._disablePayButton();
|
||||
const radio = ev.currentTarget.closest('.o_delivery_carrier_select').querySelector('input[type="radio"]');
|
||||
if (radio.checked) {
|
||||
if (radio.checked && !this._shouldDisplayPickupLocations(ev)) {
|
||||
return;
|
||||
}
|
||||
this._showLoading(radio);
|
||||
|
||||
Reference in New Issue
Block a user