From c648f0727aff2017de3ba395246de2422ff2a50d Mon Sep 17 00:00:00 2001 From: jbw Date: Wed, 18 May 2022 14:13:35 +0000 Subject: [PATCH] [FIX] account: fix zero division when unreconciling caba exch diff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add move_reverse_cancel=cancel back to context when reconciling moves with reverse moves. Bug introduced in commit https://github.com/odoo/odoo/commit/e9262bfc8c775953ebe150f36ce0ab8dcb04d4bd Database : Reproducible in v14, v15 On a Mexican company (with l10n_mx) with multi currencies enabled. - Set rates for USD to be different at invoice and at payment date - Create an invoice at date 1 in USD - Create a payment at date 2 in USD for invoice generating a difference exchange move - Try to reset the payment to draft -The traceback (ZeroDivisionError: float division by zero) will appear. Tickets : 2857549, 2856162, 2855038, 2852663, 2852859, 2857381 closes odoo/odoo#91841 X-original-commit: 7be0fc1d611d54f27ebd7e7b1fef9b1842cc9ae2 Signed-off-by: William André (wan) Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) --- addons/account/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 349bba7411b..789f9599d82 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2650,7 +2650,7 @@ class AccountMove(models.Model): group[(line.account_id, line.currency_id)].append(line.id) for (account, dummy), line_ids in group.items(): if account.reconcile or account.internal_type == 'liquidity': - self.env['account.move.line'].browse(line_ids).reconcile() + self.env['account.move.line'].browse(line_ids).with_context(move_reverse_cancel=cancel).reconcile() return reverse_moves