[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 99525f8dac
pull/819/head
Víctor Martínez 2025-03-31 08:58:12 +02:00
parent c533e46623
commit 0510276a36
1 changed files with 2 additions and 0 deletions

View File

@ -131,6 +131,8 @@ class AccountReconcileModel(models.Model):
balance = currency.round( balance = currency.round(
line.amount * (1 if residual_balance > 0.0 else -1) line.amount * (1 if residual_balance > 0.0 else -1)
) )
else:
balance = 0.0
if currency.is_zero(balance): if currency.is_zero(balance):
continue continue