[FIX] account: fix zero division when unreconciling caba exch diff
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) <wan@odoo.com> Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user