diff --git a/addons/sale_margin/models/sale_order.py b/addons/sale_margin/models/sale_order.py index 6c7f9d10dc7..7a813e1b210 100644 --- a/addons/sale_margin/models/sale_order.py +++ b/addons/sale_margin/models/sale_order.py @@ -40,6 +40,13 @@ class SaleOrderLine(models.Model): return self.purchase_price = self._compute_margin(self.order_id, self.product_id, self.product_uom) + @api.onchange('product_id') + def product_id_change(self): + # VFE FIXME : bugfix for matrix, the purchase_price will be changed to a computed field in master. + res = super(SaleOrderLine, self).product_id_change() + self.product_id_change_margin() + return res + @api.model def create(self, vals): vals.update(self._prepare_add_missing_fields(vals))