Skip to content

Commit

Permalink
Skip sign check in module init and migration, fixing the case of modu…
Browse files Browse the repository at this point in the history
…le installation when accounts are already created (otherwise installation is blocked)
  • Loading branch information
eLBati authored and SilvioGregorini committed Jan 13, 2020
1 parent 60e25ac commit 75a1cc5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions l10n_it_account/models/account_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def check_balance_sign_coherence(self):
"""
# Force recursion check
self.check_parent_recursion()
if self.env.context.get("skip_check_balance_sign_coherence"):
return
done_group_ids, progenitor_ids = [], []
for group in self:
if group.id in done_group_ids:
Expand Down
3 changes: 2 additions & 1 deletion l10n_it_account/models/account_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def set_account_types_negative_sign(self):
for xml_id in ACCOUNT_TYPES_NEGATIVE_SIGN:
acc_type = self.env.ref(xml_id, raise_if_not_found=False)
if acc_type:
acc_type.account_balance_sign = -1
acc_type.with_context(
skip_check_balance_sign_coherence=True).account_balance_sign = -1

@api.constrains('account_balance_sign')
def check_balance_sign_value(self):
Expand Down

0 comments on commit 75a1cc5

Please sign in to comment.