diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 3841f66e16d..8d5fc63154f 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -633,9 +633,10 @@ class AccountInvoice(models.Model): for line in invoice_move_lines: if self.currency_id != company_currency: currency = self.currency_id.with_context(date=self.date_invoice or fields.Date.context_today(self)) - line['currency_id'] = currency.id - line['amount_currency'] = currency.round(line['price']) - line['price'] = currency.compute(line['price'], company_currency) + if not ('currency_id' in line and 'amount_currency' in line): + line['currency_id'] = currency.id + line['amount_currency'] = currency.round(line['price']) + line['price'] = currency.compute(line['price'], company_currency) else: line['currency_id'] = False line['amount_currency'] = False diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py index 1f054a8021f..24c87be86f5 100644 --- a/addons/stock_account/stock_account.py +++ b/addons/stock_account/stock_account.py @@ -83,13 +83,21 @@ class account_invoice(osv.osv): cacc = accounts['expense'].id if dacc and cacc: price_unit = i_line._get_anglo_saxon_price_unit() + if inv.currency_id.id != company_currency: + currency_id = inv.currency_id.id + amount_currency = self.env['account.invoice.line']._get_price(inv, company_currency, i_line, price_unit) + else: + currency_id = False + amount_currency = False return [ { 'type':'src', 'name': i_line.name[:64], 'price_unit': price_unit, 'quantity': i_line.quantity, - 'price': self.env['account.invoice.line']._get_price(inv, company_currency, i_line, price_unit), + 'price': price_unit * i_line.quantity, + 'currency_id': currency_id, + 'amount_currency': amount_currency, 'account_id':dacc, 'product_id':i_line.product_id.id, 'uom_id':i_line.uom_id.id, @@ -101,7 +109,9 @@ class account_invoice(osv.osv): 'name': i_line.name[:64], 'price_unit': price_unit, 'quantity': i_line.quantity, - 'price': -1 * self.env['account.invoice.line']._get_price(inv, company_currency, i_line, price_unit), + 'price': -1 * price_unit * i_line.quantity, + 'currency_id': currency_id, + 'amount_currency': -1 * amount_currency, 'account_id':cacc, 'product_id':i_line.product_id.id, 'uom_id':i_line.uom_id.id,