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 15, 2020
1 parent f80b9e3 commit 031dc67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion l10n_it_account/models/account_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ def check_balance_sign_coherence(self):
"""
# Force recursion check
self.check_parent_recursion()
done_group_ids, progenitor_ids = [], []
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:
continue
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 @@ -29,7 +29,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 031dc67

Please sign in to comment.