[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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user