From 214231fbced3ebd99a309a4e64e933946c35f352 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 30 Mar 2016 18:38:43 +0200 Subject: [PATCH] [FIX] purchase: _get_price_unit_invoice If the costing method of the product is "average", the price unit of the stock move is set in the currency of the field "price_currency_id" with the function "do_partial" (addons/stock/stock.py). opw:672552 --- addons/purchase/stock.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index 00ded4c91f1..c61d7f719cf 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -89,8 +89,12 @@ class stock_picking(osv.osv): if move_line.purchase_line_id.order_id.invoice_method == 'picking': 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, + if move_line.product_id.cost_method == 'average' and move_line.price_currency_id: + if move_line.price_currency_id.id != order.currency_id.id: + price_unit = self.pool.get('res.currency').compute(cursor, user, + move_line.price_currency_id.id, order.currency_id.id, move_line.price_unit, round=False, context=dict({}, date=order.date_order)) + elif 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: