From f1608829a17639fe03ef495aa627a557d0138108 Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Tue, 13 Mar 2018 16:55:36 +0100 Subject: [PATCH] [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 --- addons/account/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 922e30a0b67..ee1aded3938 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -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: