diff --git a/product_sale_price_from_pricelist/models/stock_move.py b/product_sale_price_from_pricelist/models/stock_move.py index 26521be..9e5a408 100644 --- a/product_sale_price_from_pricelist/models/stock_move.py +++ b/product_sale_price_from_pricelist/models/stock_move.py @@ -75,10 +75,12 @@ class StockMove(models.Model): ), move.product_id.last_purchase_price_compute_type, ) - move.product_id.with_company( - move.company_id - ).last_purchase_price_received = price_updated - move.product_id.with_company( - move.company_id - )._compute_theoritical_price() + # Use write() to ensure value is persisted before computing price + product_company = move.product_id.with_company(move.company_id) + product_company.write( + { + "last_purchase_price_received": price_updated, + } + ) + product_company._compute_theoritical_price() return res