From f78f1f4a57b504d4f80438ef0d8b7626dd62d4a5 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Sat, 17 Jun 2023 08:33:11 +0200 Subject: [PATCH] [IMP] account_reconciliation_widget: Skip business models synchronization on reconcile There's no need to synchronize business models (payments and statement lines) when the reconcile is done, as the only value written in the journal item is `full_reconcile_id`. This way, we speed up the reconciliation process through the widget. --- .../models/reconciliation_widget.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/account_reconciliation_widget/models/reconciliation_widget.py b/account_reconciliation_widget/models/reconciliation_widget.py index 6e91f075..ab756351 100644 --- a/account_reconciliation_widget/models/reconciliation_widget.py +++ b/account_reconciliation_widget/models/reconciliation_widget.py @@ -1152,10 +1152,11 @@ class AccountReconciliation(models.AbstractModel): """ if len(move_line_ids) < 1 or len(move_line_ids) + len(new_mv_line_dicts) < 2: raise UserError(_("A reconciliation must involve at least 2 move lines.")) - - account_move_line = self.env["account.move.line"].browse(move_line_ids) - writeoff_lines = self.env["account.move.line"] - + AccountMoveLine = self.env["account.move.line"].with_context( + skip_account_move_synchronization=True + ) + account_move_line = AccountMoveLine.browse(move_line_ids) + writeoff_lines = AccountMoveLine # Create writeoff move lines if len(new_mv_line_dicts) > 0: company_currency = account_move_line[0].account_id.company_id.currency_id