diff options
| author | Goffin Simon <sig@odoo.com> | 2016-06-20 11:35:39 +0200 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2016-06-20 14:20:53 +0200 |
| commit | 6101b856f0a7a18b94b3fc080cb686c40d5fc736 (patch) | |
| tree | b6334e90239c3b48df853bf2ec7628144d4317cb | |
| parent | e37ba6183269b0d075833efbb9bf26e99404247e (diff) | |
[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
| -rw-r--r-- | addons/account/models/account_move.py | 5 |
1 files changed, 4 insertions, 1 deletions
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) |
