Skip to content

Commit

Permalink
Merge pull request #1 from eLBati/12.0-FIX-l10n_it_account_balance_si…
Browse files Browse the repository at this point in the history
…gns-lb

Skip sign check in module init and migration, fixing the case of modu…
  • Loading branch information
SilvioGregorini committed Jan 13, 2020
2 parents 68a425d + 5359ed3 commit 50220c2
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 50220c2

Please sign in to comment.