[FIX] website_sale: remove reward line from cart
Steps to reproduce: - go to e-commerce; - add a product to the cart; - add a gift card; - remove the gift card form the cart. (the user must not belong to the group 'base.group_system') Issue: A user error appears. Cause: The gift card is a product that cannot be added to the cart like the others. Therefore, an error is triggered. Solution: Make the error trigger only when adding products to the cart. opw-3114090 closes odoo/odoo#109654 X-original-commit: 9cc699b89688261220aeb39a99fd866c27808d0a Signed-off-by: William Braeckman (wbr) <wbr@odoo.com> Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
This commit is contained in:
@@ -129,7 +129,7 @@ class SaleOrder(models.Model):
|
||||
raise UserError(_('It is forbidden to modify a sales order which is not in draft status.'))
|
||||
|
||||
product = self.env['product.product'].browse(product_id).exists()
|
||||
if not product or not product._is_add_to_cart_allowed():
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user