[FIX] account: add missing constrains dependencies

Create a move line having:

amount_currency = 1000
debit = 0
credit = 1000

The error is raised, it's ok.

Now, create a move line having:

amount_currency = 1000
debit = 1000
credit = 0

Then save, edit and write:

debit = 0
credit = 1000

No error raised, it's wrong!

-opw 1818714
This commit is contained in:
Laurent Smet
2018-03-13 16:55:36 +01:00
parent 7c6da3e076
commit f1608829a1
+1 -1
View File
@@ -444,7 +444,7 @@ class AccountMoveLine(models.Model):
raise UserError(_("You cannot create journal items with a secondary currency without filling both 'currency' and 'amount currency' field."))
@api.multi
@api.constrains('amount_currency')
@api.constrains('amount_currency', 'debit', 'credit')
def _check_currency_amount(self):
for line in self:
if line.amount_currency: