[FIX] account: prevent traceback

When changing the date of an account move, the method
`_onchange_amount_currency` is called manually on a recordset. If the
recordset length is > 1, it crashes.
This commit is contained in:
Nicolas Martinelli
2017-12-22 13:38:30 +01:00
committed by Nicolas Martinelli
parent a1aed05f8d
commit c0769c753c
+1 -1
View File
@@ -518,7 +518,7 @@ class AccountMoveLine(models.Model):
for line in self:
amount = line.amount_currency
if line.currency_id and line.currency_id != line.company_currency_id:
amount = self.currency_id.with_context(date=line.date).compute(amount, line.company_currency_id)
amount = line.currency_id.with_context(date=line.date).compute(amount, line.company_currency_id)
line.debit = amount > 0 and amount or 0.0
line.credit = amount < 0 and -amount or 0.0