summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Grazioso (agr-odoo) <agr@odoo.com>2021-01-18 09:44:23 +0000
committerAndrea Grazioso (agr-odoo) <agr@odoo.com>2021-01-18 10:31:04 +0000
commit655597e9a3637abbaeffddcc78663e8733070db4 (patch)
treed1779459f83eafe8a849a27745ae84712f664f9c
parenta3ab5c3a73243e6f4d5662ee27765439ba9b5363 (diff)
[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#64667 Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
-rw-r--r--addons/account/models/account_move.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index eabd1cdcc2a..059cf1d7ae8 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -3636,10 +3636,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