[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 <abla@odoo.com>
This commit is contained in:
Abdelouahab (abla)
2023-05-16 13:37:22 +02:00
parent 031ea4d351
commit 66b625c20b
+1 -1
View File
@@ -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)