[FIX]account_edi: set PdfFileReader to strict=False

Determines whether user should be warned of all problems and also causes some correctable problems to be fatal. Since we just want the widest compatibility when reading PDF, strict=False seems acceptable.

TASK ID: 2358822

closes odoo/odoo#59736

X-original-commit: 9fb637577e0c13778e253b4f1329f59459ab0824
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: bfr-o <bfr-o@users.noreply.github.com>
This commit is contained in:
Benjamin Frantzen (bfr)
2020-10-12 11:04:33 +00:00
parent 5af18fbd9e
commit 25023e59e2
@@ -232,7 +232,7 @@ class AccountEdiFormat(models.Model):
if attachments:
# Add the attachments to the pdf file
reader_buffer = io.BytesIO(pdf_content)
reader = OdooPdfFileReader(reader_buffer)
reader = OdooPdfFileReader(reader_buffer, strict=False)
writer = OdooPdfFileWriter()
writer.cloneReaderDocumentRoot(reader)
for vals in attachments:
@@ -290,7 +290,7 @@ class AccountEdiFormat(models.Model):
to_process = []
try:
buffer = io.BytesIO(content)
pdf_reader = OdooPdfFileReader(buffer)
pdf_reader = OdooPdfFileReader(buffer, strict=False)
except Exception as e:
# Malformed pdf
_logger.exception("Error when reading the pdf: %s" % e)