[FIX] purchase_stock: avoid updating kit components price_unit
closes odoo/odoo#97656 X-original-commit: d491d2054ecb8852b0921a7b863f108a0b62155e Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
committed by
William Henrotin
parent
33faa55b63
commit
1cce589a65
@@ -368,7 +368,10 @@ class PurchaseOrderLine(models.Model):
|
||||
previous_product_qty = {line.id: line.product_uom_qty for line in lines}
|
||||
result = super(PurchaseOrderLine, self).write(values)
|
||||
if 'price_unit' in values:
|
||||
self.move_ids.price_unit = self.price_unit
|
||||
for line in lines:
|
||||
# Avoid updating kit components' stock.move
|
||||
moves = line.move_ids.filtered(lambda s: s.state not in ('cancel', 'done') and s.product_id == line.product_id)
|
||||
moves.write({'price_unit': line.price_unit})
|
||||
if 'product_qty' in values:
|
||||
lines.with_context(previous_product_qty=previous_product_qty)._create_or_update_picking()
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user