Odoo18-Base/addons/account_edi/wizard/account_resequence.py
2025-01-06 10:57:38 +07:00

15 lines
579 B
Python

from odoo import _, models
from odoo.exceptions import UserError
class ReSequenceWizard(models.TransientModel):
_inherit = 'account.resequence.wizard'
def resequence(self):
edi_sent_moves = self.move_ids.edi_document_ids.filtered(lambda d: d.edi_format_id._needs_web_services() and d.state == 'sent')
if edi_sent_moves:
raise UserError(_("The following documents have already been sent and cannot be resequenced: %s")
% ", ".join(set(edi_sent_moves.move_id.mapped('name')))
)
return super().resequence()