[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 <smetl@users.noreply.github.com> Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user