[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
This commit is contained in:
Goffin Simon
2016-06-20 14:20:53 +02:00
parent e37ba61832
commit 6101b856f0
+4 -1
View File
@@ -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)