[14.0][FIX] allow multiple refunds

This commit is contained in:
Kev-Roche
2024-12-05 20:46:42 +01:00
parent f3a6cfade6
commit 515659c069

View File

@@ -21,7 +21,9 @@ class AccountMoveReversal(models.TransientModel):
moves = amo.browse(self._context['active_ids']) moves = amo.browse(self._context['active_ids'])
if len(moves) == 1 and moves.move_type not in ('out_invoice', 'in_invoice'): if len(moves) == 1 and moves.move_type not in ('out_invoice', 'in_invoice'):
res['date'] = moves.date + relativedelta(days=1) res['date'] = moves.date + relativedelta(days=1)
reversed_move = amo.search([('reversed_entry_id', 'in', moves.ids)], limit=1) entry_moves = moves.filtered(lambda m: m.move_type == "entry")
if entry_moves:
reversed_move = amo.search([('reversed_entry_id', 'in', entry_moves.ids)], limit=1)
if reversed_move: if reversed_move:
raise UserError(_( raise UserError(_(
"Move '%s' has already been reversed by move '%s'.") % ( "Move '%s' has already been reversed by move '%s'.") % (