Skip to content
Snippets Groups Projects
Commit 0b8eb71d authored by Victor Feyens's avatar Victor Feyens
Browse files

[FIX] sale_margin: recompute purchase_price on product_id_change.


When creating sale order lines from the matrix (sale_product_matrix),
the purchase_price weren't computed

No cleaner change has been found to ensure the cost is computed.

Triggering all onchanges from the server side is quite tricky and dirty
to do...

closes odoo/odoo#40986

X-original-commit: 5c15b131
Signed-off-by: default avatarVictor Feyens (vfe) <vfe@odoo.com>
parent 75810977
Branches
Tags
No related merge requests found
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment