[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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user