diff --git a/addons/account_edi/models/account_edi_format.py b/addons/account_edi/models/account_edi_format.py index 0bb5e791a97..d945f79ad2c 100644 --- a/addons/account_edi/models/account_edi_format.py +++ b/addons/account_edi/models/account_edi_format.py @@ -8,6 +8,7 @@ from odoo.tools import html_escape from odoo.exceptions import RedirectWarning from lxml import etree +from struct import error as StructError import base64 import io import logging @@ -242,7 +243,7 @@ class AccountEdiFormat(models.Model): try: for xml_name, content in pdf_reader.getAttachments(): to_process.extend(self._decode_xml(xml_name, content)) - except NotImplementedError as e: + except (NotImplementedError, StructError) as e: _logger.warning("Unable to access the attachments of %s. Tried to decrypt it, but %s." % (filename, e)) # Process the pdf itself.