[FIX] account: allow to skip account constraint

To fully allow f4e67d8ae174d7e2ee75a1de1083b31a6ff2af8b
we need also to disable to check on account when
the constraint field has been used to set the account on
the journal

opw-2394959

closes odoo/odoo#64792

X-original-commit: 655597e9a3637abbaeffddcc78663e8733070db4
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2021-01-20 12:14:56 +00:00
parent 03f14189cb
commit e08e4826d7
+2 -2
View File
@@ -3675,10 +3675,10 @@ class AccountMoveLine(models.Model):
raise UserError(_('You cannot use this account (%s) in this journal, check the field \'Allowed Journals\' on the related account.', account.display_name))
failed_check = False
if journal.type_control_ids or journal.account_control_ids:
if (journal.type_control_ids - journal.default_account_id.user_type_id) or journal.account_control_ids:
failed_check = True
if journal.type_control_ids:
failed_check = account.user_type_id not in journal.type_control_ids
failed_check = account.user_type_id not in (journal.type_control_ids - journal.default_account_id.user_type_id)
if failed_check and journal.account_control_ids:
failed_check = account not in journal.account_control_ids