[FIX] account: skip banner on faulty PDF
create a vendor Bill attach the PDF go back to list view, select the bill > print Original Bills Issue: a traceback is raised Similar to f814c607e5ab7ed6f1e594ec8c602a749fcc775d In some malformed PDF files zlib is unable to extract the data properly. opw-3368907 closes odoo/odoo#125501 X-original-commit: 6dd9fee03a50310a4db63e3f263eb43ab808dbc7 Signed-off-by: John Laterre (jol) <jol@odoo.com> Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from collections import OrderedDict
|
||||
|
||||
from zlib import error as zlib_error
|
||||
try:
|
||||
from PyPDF2.errors import PdfStreamError, PdfReadError
|
||||
except ImportError:
|
||||
@@ -36,7 +36,7 @@ class IrActionsReport(models.Model):
|
||||
record = self.env[attachment.res_model].browse(attachment.res_id)
|
||||
try:
|
||||
stream = pdf.add_banner(stream, record.name, logo=True)
|
||||
except (ValueError, PdfStreamError, PdfReadError, TypeError):
|
||||
except (ValueError, PdfStreamError, PdfReadError, TypeError, zlib_error):
|
||||
record._message_log(body=_(
|
||||
"There was an error when trying to add the banner to the original PDF.\n"
|
||||
"Please make sure the source file is valid."
|
||||
|
||||
Reference in New Issue
Block a user