[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
This commit is contained in:
Yannick Tivisse
2017-01-31 13:16:20 +01:00
parent 3aafb6f8e3
commit 4c58f96c5d
+2 -2
View File
@@ -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}