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