[FIX] prevent contraint trigger currency revaluation error on reconcile (Forward port of bug fix : 6c540d23de )

This commit is contained in:
vrenaville
2015-07-16 15:36:12 +02:00
parent 268c438775
commit 9bc86c64a0

View File

@@ -126,6 +126,9 @@ class AccountMoveLine(models.Model):
@api.constrains('amount_currency') @api.constrains('amount_currency')
def _check_currency_amount(self): def _check_currency_amount(self):
for l in self: for l in self:
# If account have a second currency, don't apply constraint
if l.account_id.currency_id:
continue
if l.amount_currency: if l.amount_currency:
if ((l.amount_currency > 0.0 and l.credit > 0.0) or if ((l.amount_currency > 0.0 and l.credit > 0.0) or
(l.amount_currency < 0.0 and l.debit > 0.0)): (l.amount_currency < 0.0 and l.debit > 0.0)):