From 25023e59e20cc1c7b0d4df6efec093e2dfd341e7 Mon Sep 17 00:00:00 2001 From: "Benjamin Frantzen (bfr)" Date: Mon, 12 Oct 2020 08:08:30 +0000 Subject: [PATCH] [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 Signed-off-by: bfr-o --- addons/account_edi/models/account_edi_format.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_edi/models/account_edi_format.py b/addons/account_edi/models/account_edi_format.py index ef3ce16166d..d86e2db6f52 100644 --- a/addons/account_edi/models/account_edi_format.py +++ b/addons/account_edi/models/account_edi_format.py @@ -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)