[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) <etdj@odoo.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user