From 8e54d8b9860367b5beb120e858d882072182fc59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BEAU?= Date: Tue, 8 Oct 2024 00:03:02 +0200 Subject: [PATCH] account_balance_reset: do not reconcile already reconcile move, skip useless sync of business field --- account_balance_reset/wizards/account_balance_reset.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/account_balance_reset/wizards/account_balance_reset.py b/account_balance_reset/wizards/account_balance_reset.py index 42cf8af..c7af678 100644 --- a/account_balance_reset/wizards/account_balance_reset.py +++ b/account_balance_reset/wizards/account_balance_reset.py @@ -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), ] @@ -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),