From d2b97524f2161e644271ee0b13c530b1d9aff51d Mon Sep 17 00:00:00 2001 From: "Abdelouahab (abla)" <abla@odoo.com> 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#120756 Signed-off-by: abla001 <abla@odoo.com> --- 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 56b7fb36dadc..0f472e687e3a 100644 --- a/odoo/addons/base/models/ir_actions_report.py +++ b/odoo/addons/base/models/ir_actions_report.py @@ -787,7 +787,7 @@ class IrActionsReport(models.Model): reader = PdfFileReader(stream) writer.appendPagesFromReader(reader) writer.write(result_stream) - except utils.PdfReadError: + except (utils.PdfReadError, TypeError): unreadable_streams.append(stream) return unreadable_streams -- GitLab