From b41e65ba7bdf69b929358f9de3be97d5a715c51d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 5 Mar 2013 10:38:11 +0100 Subject: [PATCH] Fix missing unit_price currency convertion issue3036 review698002 --- stock.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stock.py b/stock.py index d5034a9a5a..3cb8fb7211 100644 --- a/stock.py +++ b/stock.py @@ -32,13 +32,17 @@ class Move: pool = Pool() Uom = pool.get('product.uom') AccountMoveLine = pool.get('account.move.line') + Currency = pool.get('currency.currency') lines = super(Move, self)._get_account_stock_move_lines(type_) if (type_.endswith('supplier') and self.product.cost_price_method == 'fixed'): cost_price = Uom.compute_price(self.product.default_uom, self.cost_price, self.uom) + with Transaction().set_context(date=self.effective_date): + unit_price = Currency.compute(self.currency, self.unit_price, + self.company.currency, round=False) amount = self.company.currency.round( - Decimal(str(self.quantity)) * (self.unit_price - cost_price)) + Decimal(str(self.quantity)) * (unit_price - cost_price)) if self.company.currency.is_zero(amount): return lines account = self.product.account_stock_supplier_used