[FIX] website_sale_delivery: do not check delivery for only services
Steps to reproduce: - Setup easypost delivery - Create a service product and publish it on the website - Add that product alone to the cart and proceed to payment Bug: Error raised because total weight of the order is null Fix: no delivery will be created so we should skip the check if no deliverable product is present on the order note: on "_get_shop_payment_errors" switched the order to short circuit "_get_delivery_methods" opw-3647420 closes odoo/odoo#150735 X-original-commit: 3108339921dd7af65daacf60dc0104713116557b Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
This commit is contained in:
@@ -1722,10 +1722,9 @@ class WebsiteSale(payment_portal.PaymentPortal):
|
||||
:return: A list of errors (error_title, error_message)
|
||||
:rtype: list[tuple]
|
||||
"""
|
||||
has_storable_products = any(line.product_id.type in ['consu', 'product'] for line in order.order_line)
|
||||
errors = []
|
||||
|
||||
if not order._get_delivery_methods() and has_storable_products:
|
||||
if not order.only_services and not order._get_delivery_methods():
|
||||
errors.append((
|
||||
_('Sorry, we are unable to ship your order'),
|
||||
_('No shipping method is available for your current order and shipping address. '
|
||||
@@ -1746,7 +1745,7 @@ class WebsiteSale(payment_portal.PaymentPortal):
|
||||
"""
|
||||
order = request.website.sale_get_order()
|
||||
|
||||
if order and (request.httprequest.method == 'POST' or not order.carrier_id):
|
||||
if order and not order.only_services and (request.httprequest.method == 'POST' or not order.carrier_id):
|
||||
# Update order's carrier_id (will be the one of the partner if not defined)
|
||||
# If a carrier_id is (re)defined, redirect to "/shop/payment" (GET method to avoid infinite loop)
|
||||
carrier_id = post.get('carrier_id')
|
||||
|
||||
Reference in New Issue
Block a user