diff --git a/addons/website_sale/models/sale_order.py b/addons/website_sale/models/sale_order.py index 4bcf08dfa3e..1d21faea6ce 100644 --- a/addons/website_sale/models/sale_order.py +++ b/addons/website_sale/models/sale_order.py @@ -166,9 +166,6 @@ class SaleOrder(models.Model): if add_qty and (not product or not product._is_add_to_cart_allowed()): raise UserError(_("The given product does not exist therefore it cannot be added to cart.")) - if product.lst_price == 0 and product.website_id.prevent_zero_price_sale: - raise UserError(_("The given product does not have a price therefore it cannot be added to cart.")) - if line_id is not False: order_line = self._cart_find_product_line(product_id, line_id, **kwargs)[:1] else: @@ -211,6 +208,11 @@ class SaleOrder(models.Model): order_line = self._cart_update_order_line(product_id, quantity, order_line, **kwargs) + if order_line and order_line.price_unit == 0 and self.website_id.prevent_zero_price_sale: + raise UserError(_( + "The given product does not have a price therefore it cannot be added to cart.", + )) + return { 'line_id': order_line.id, 'quantity': quantity,