Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

14.0 fix account balance reset #11

Open
wants to merge 1 commit into
base: 14.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions account_balance_reset/wizards/account_balance_reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def run(self):
rec_domain = [
("account_id", "=", line.account_id.id),
("partner_id", "=", line.partner_id.id or False),
("full_reconcile_id", "=", False),
("reconciled", "=", False),
("date", "<=", self.date),
("company_id", "=", company_id),
]
Expand All @@ -121,7 +121,13 @@ def run(self):
balance = rec_rg[0]["balance"]
if ccur.is_zero(balance):
lines = amlo.search(rec_domain)
lines.reconcile()
# doing a reconcile will do a write on the field full_reconcile_id and
# the write will always trigger the synchronisation of business field
# this is useless as we just do a reconcilisation !
# it can also raise error on old move where the journal
# config have been updated
# so let's use skip_account_move_synchronization
lines.with_context(skip_account_move_synchronization=True).reconcile()
logger.info(
"Reconciled %d lines for account %s partner %s",
len(lines),
Expand Down