From 075a30f4030218b5e6f9f74cf73ec80fea6866b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 28 Jul 2021 00:35:50 +0200 Subject: [PATCH] Use unit_price_company issue10586 review369311002 --- product.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/product.py b/product.py index ae1fccdb94..3e2a417da2 100644 --- a/product.py +++ b/product.py @@ -337,7 +337,6 @@ class Product(StockMixin, object, metaclass=PoolMeta): def recompute_cost_price_average(self, start=None): pool = Pool() Move = pool.get('stock.move') - Currency = pool.get('currency.currency') Uom = pool.get('product.uom') Revision = pool.get('product.cost_price.revision') @@ -406,12 +405,7 @@ class Product(StockMixin, object, metaclass=PoolMeta): if out_move(move): qty *= -1 if in_move(move): - with Transaction().set_context(date=move.effective_date): - unit_price = Currency.compute( - move.currency, move.unit_price, - move.company.currency, round=False) - unit_price = Uom.compute_price( - move.uom, unit_price, self.default_uom) + unit_price = move.get_cost_price(product_cost_price=cost_price) if quantity + qty > 0 and quantity >= 0: cost_price = ( (cost_price * quantity) + (unit_price * qty)