[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
This commit is contained in:
Nicolas Martinelli 2015-06-30 12:24:30 +02:00
parent 0f82346167
commit 2a49c1a7fb
1 changed files with 6 additions and 1 deletions

View File

@ -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)