From 6b521066c2053aa2c9efe9f3b91275c01ac868db Mon Sep 17 00:00:00 2001 From: "Eteil Djoumatchoua(etdj)" Date: Tue, 5 Sep 2023 15:49:27 +0200 Subject: [PATCH] [FIX] website_sale: Don't get error when selecting shipping method after refresh Steps: - Publish Standard method and Mondial relay shipping methods. - Empty rules and countries on mondial relay shipping method. - Go to shop, add a product and checkout. - On the final checkout page, click on mondial relay and cancel the popup without choosing the location. - Refresh the page. - Click on Standard delivery then click on Mondial relay. Issue: We get an error(Null value of a variable) or the popup doesn't pop. Reason: When selecting the mondial relay method without location info, the ``SaleOrder.carrier_id`` of the order is set but ``SaleOrder.delivery_rating_sucess`` is set to False(we didn't enter the location information). Because of that when refreshing and calling ``_get_shop_payment_values()``, delivery line is removed from the order. Here we just add the default delivery method. opw-3468202 closes odoo/odoo#137418 X-original-commit: 686244ded63748196bbbea5773e55585015782f2 Signed-off-by: Eteil Junior Djoumatchoua (etdj) --- addons/website_sale/controllers/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 86051e6f818..cffcc1acee9 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -1596,6 +1596,7 @@ class WebsiteSale(payment_portal.PaymentPortal): if has_storable_products: if order.carrier_id and not order.delivery_rating_success: order._remove_delivery_line() + order._check_carrier_quotation() values['deliveries'] = order._get_delivery_methods().sudo() values['delivery_has_storable'] = has_storable_products