From 0510276a36e57134d133f3774bb8e2d531f30876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Mon, 31 Mar 2025 08:58:12 +0200 Subject: [PATCH] [FIX] account_reconcile_model_oca: Fix unassigned variable 'balance' It seems some people are getting an "unassigned variable 'balance'". This shouldn't happen with the standard code because _get_write_off_move_lines_dict is only called from the manual reconciliation widget in which, you only have access to models having strictly lines being percentage or fixed (see get_reconcile_modelds_for_manual_reconciliation). This method is not called from the bank reco widget pointed by "RECONCILE x ITEMS" on the accounting dashboard. It probably comes from some customization but I don't know which ones. Related to https://github.com/odoo/odoo/commit/99525f8dac17170a59ed10e471a8ea364258884c --- account_reconcile_model_oca/models/account_reconcile_model.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/account_reconcile_model_oca/models/account_reconcile_model.py b/account_reconcile_model_oca/models/account_reconcile_model.py index 2694f7fa..43f67e82 100644 --- a/account_reconcile_model_oca/models/account_reconcile_model.py +++ b/account_reconcile_model_oca/models/account_reconcile_model.py @@ -131,6 +131,8 @@ class AccountReconcileModel(models.Model): balance = currency.round( line.amount * (1 if residual_balance > 0.0 else -1) ) + else: + balance = 0.0 if currency.is_zero(balance): continue