From 66b625c20bc7ff72078d7340f35ded5469562640 Mon Sep 17 00:00:00 2001 From: "Abdelouahab (abla)" Date: Mon, 8 May 2023 08:32:26 +0000 Subject: [PATCH] [FIX] base: merging unreadable pdfs To Reproduce ============ - create two Vendor Bills and attach to each one a PDF from the ones provided by the client on the ticket. - select these two bills and and try to print Original Bills an error will be raised Problem ======= while merging these PDFs, PyPDF2 throws a `TypeError` which is not caught by the server Solution ======== catch `TypeError` to raise a UserError opw-3285540 closes odoo/odoo#121313 X-original-commit: 5053620c640136025f5b37c5b8d233ad63825389 Signed-off-by: abla001 --- odoo/addons/base/models/ir_actions_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/models/ir_actions_report.py b/odoo/addons/base/models/ir_actions_report.py index b690453c345..fde6e6bace8 100644 --- a/odoo/addons/base/models/ir_actions_report.py +++ b/odoo/addons/base/models/ir_actions_report.py @@ -626,7 +626,7 @@ class IrActionsReport(models.Model): try: reader = PdfFileReader(stream) writer.appendPagesFromReader(reader) - except PdfReadError: + except (PdfReadError, TypeError): raise UserError(_("Odoo is unable to merge the generated PDFs.")) result_stream = io.BytesIO() streams.append(result_stream)