From 4c58f96c5da9bbc55c7a47594e069f250cf5dbec Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Tue, 31 Jan 2017 11:32:58 +0100 Subject: [PATCH] [FIX] website_sale: Call SO lines write and unlink as ORM commands That way, the coupon reward line validations methods are still called on the ecommerce --- addons/website_sale/models/sale_order.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website_sale/models/sale_order.py b/addons/website_sale/models/sale_order.py index 7af22085041..e125c430c4b 100644 --- a/addons/website_sale/models/sale_order.py +++ b/addons/website_sale/models/sale_order.py @@ -139,7 +139,7 @@ class SaleOrder(models.Model): # Remove zero of negative lines if quantity <= 0: - order_line.unlink() + order_line.order_id.write({'order_line': [(2, order_line.id, False)]}) else: # update line values = self._website_product_id_change(self.id, product_id, qty=quantity) @@ -149,7 +149,7 @@ class SaleOrder(models.Model): if self.pricelist_id.discount_policy == 'with_discount' and not self.env.context.get('fixed_price'): values['price_unit'] = order_line._get_display_price(order_line.product_id) - order_line.write(values) + order_line.order_id.write({'order_line': [(1, order_line.id, values)]}) return {'line_id': order_line.id, 'quantity': quantity}