From 2a49c1a7fbbcfd5ebd52f03ad031b54a7c9e4911 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 30 Jun 2015 12:24:30 +0200 Subject: [PATCH] [FIX] purchase: take into account the currency of unit price The currency of the unit price of the stock.move is the currency of the company, which can be different from the currency of the invoice. opw-643077 --- addons/purchase/stock.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index c211f39e719..00ded4c91f1 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -87,7 +87,12 @@ class stock_picking(osv.osv): def _get_price_unit_invoice(self, cursor, user, move_line, type): if move_line.purchase_line_id: if move_line.purchase_line_id.order_id.invoice_method == 'picking': - return move_line.price_unit + price_unit = move_line.price_unit + order = move_line.purchase_line_id.order_id + if order.currency_id.id != order.company_id.currency_id.id: + price_unit = self.pool.get('res.currency').compute(cursor, user, + order.company_id.currency_id.id, order.currency_id.id, move_line.price_unit, round=False, context=dict({}, date=order.date_order)) + return price_unit else: return move_line.purchase_line_id.price_unit return super(stock_picking, self)._get_price_unit_invoice(cursor, user, move_line, type)