From a11092834e32c7ef216e5b2f7b0814b36bf3280c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20Laukavi=C4=8Dius?= Date: Fri, 12 Jul 2024 09:58:41 +0300 Subject: [PATCH] [FIX] report_py3o: adapt for python > 3.10 standard odoo now installs PyPDF2==2.12.1 if python used is >3.10. And it no longer has module PyPDF2.pdf. --- report_py3o/tests/test_report_py3o.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/report_py3o/tests/test_report_py3o.py b/report_py3o/tests/test_report_py3o.py index 6ef02b541d..fd11b21f4c 100644 --- a/report_py3o/tests/test_report_py3o.py +++ b/report_py3o/tests/test_report_py3o.py @@ -12,7 +12,13 @@ import pkg_resources from PyPDF2 import PdfFileWriter -from PyPDF2.pdf import PageObject + +try: + from PyPDF2.pdf import PageObject +# If python > 3.10, odoo installs PyPDF2==2.12.1 and it no longer has +# PyPDF2.pdf module. +except ModuleNotFoundError: + from PyPDF2 import PageObject from odoo import tools from odoo.exceptions import ValidationError