[FIX] product_sale_price_from_pricelist: use write() for price update

Use write() instead of direct assignment to ensure last_purchase_price_received
is persisted before computing theoretical price. The with_company() creates a
new recordset and direct assignment may not propagate correctly.
This commit is contained in:
snt 2026-02-12 19:33:33 +01:00
parent b916779a67
commit f3a258766b

View file

@ -75,10 +75,12 @@ class StockMove(models.Model):
), ),
move.product_id.last_purchase_price_compute_type, move.product_id.last_purchase_price_compute_type,
) )
move.product_id.with_company( # Use write() to ensure value is persisted before computing price
move.company_id product_company = move.product_id.with_company(move.company_id)
).last_purchase_price_received = price_updated product_company.write(
move.product_id.with_company( {
move.company_id "last_purchase_price_received": price_updated,
)._compute_theoritical_price() }
)
product_company._compute_theoritical_price()
return res return res