From ff26ed5b775a1cac7708d01eb6b9cb545a4a5e5f Mon Sep 17 00:00:00 2001 From: oco-odoo Date: Fri, 24 Apr 2020 08:40:01 +0000 Subject: [PATCH] [FIX] account: don't raise an error when using account controls together with section/notes lines on invoices Section and note invoice lines are now account.move.line objects with a distinct value in display_type field. When restricting the use of accounts on a payable/receivable journal and making an invoice in it with at least one section or note, and only using legal accounts, it always failed, as the note/section account was empty, hence not in the allowed accounts. closes odoo/odoo#50297 X-original-commit: 28cd50f203c019b78f55fc16120af81c901caef2 Signed-off-by: Laurent Smet Signed-off-by: oco-odoo --- 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 8b87fe56542..434c2d05bd4 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -3374,7 +3374,7 @@ class AccountMoveLine(models.Model): @api.constrains('account_id', 'journal_id') def _check_constrains_account_id_journal_id(self): - for line in self: + for line in self.filtered(lambda x: x.display_type not in ('line_section', 'line_note')): account = line.account_id journal = line.move_id.journal_id