Read only cost price from the history product when computing cost value

Closes #13767
(grafted from dc91e07427dec54b2dfcd323dd444e00ef92d313)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier committed 2024-12-20 11:48:10 +01:00
1 parent 1a11eb4b34
commit f903732d69
1 file changed
+3 -3
+3 -3
View File
@@ -249,11 +249,11 @@ class Product(StockMixin, object, metaclass=PoolMeta):
products = [p for p in products
if p.create_date <= context['_datetime']]
with Transaction().set_context(context):
for product in cls.browse(products):
for product, h_product in zip(products, cls.browse(products)):
# The product may not have a cost price
if product.cost_price is not None:
if h_product.cost_price is not None:
cost_values[product.id] = round_price(
Decimal(str(product.quantity)) * product.cost_price)
Decimal(str(product.quantity)) * h_product.cost_price)
return cost_values
@classmethod