From 6101b856f0a7a18b94b3fc080cb686c40d5fc736 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 20 Jun 2016 11:35:39 +0200 Subject: [PATCH] [FIX] Wrong amount currency in account move line When computing the amount currency, the date must be set in the context to use the right currency rate. opw:680693 --- addons/account/models/account_move.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index a465c7567f1..376a75cedd0 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1075,8 +1075,11 @@ class AccountMoveLine(models.Model): } bank = self.env["account.bank.statement"].browse(vals.get('statement_id')) if bank.currency_id != bank.company_id.currency_id: + ctx = {} + if 'date' in vals: + ctx['date'] = vals['date'] temp['currency_id'] = bank.currency_id.id - temp['amount_currency'] = bank.company_id.currency_id.compute(tax_vals['amount'], bank.currency_id, round=True) + temp['amount_currency'] = bank.company_id.currency_id.with_context(ctx).compute(tax_vals['amount'], bank.currency_id, round=True) tax_lines_vals.append(temp) new_line = super(AccountMoveLine, self).create(vals)