From e08e4826d7240d5fcf753638dfba376fdd17d7cf Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Mon, 18 Jan 2021 09:44:23 +0000 Subject: [PATCH] [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 --- addons/account/models/account_move.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 4b4ad611538..fbafbac8ab2 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -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