fix(docker): stop legacy PyPDF2 3.x shadowing pypdf, breaking multi-record PDF print - #407
Open
gonzalesedwin1123 wants to merge 2 commits into
Open
fix(docker): stop legacy PyPDF2 3.x shadowing pypdf, breaking multi-record PDF print#407gonzalesedwin1123 wants to merge 2 commits into
gonzalesedwin1123 wants to merge 2 commits into
Conversation
…ecord PDF print Odoo's setup.py declares an unpinned PyPDF2, so the editable install pulled legacy PyPDF2 3.0.1 next to the pypdf 5.4.0 that OCB's requirements.txt pins for Python 3.13. odoo.tools.pdf probes PyPDF2 first with no version guard, and its removed 1.x API (reader.numPages) raises DeprecationError in _render_qweb_pdf_prepare_streams whenever more than one record is printed. Install Odoo with --no-deps (its real dependencies are already installed from requirements.txt) and add a regression test in spp_base_common that exercises the legacy split API against the image's selected PDF backend. Fixes OP#1168
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 19.0 #407 +/- ##
==========================================
+ Coverage 71.49% 72.34% +0.84%
==========================================
Files 243 404 +161
Lines 20785 29008 +8223
==========================================
+ Hits 14860 20985 +6125
- Misses 5925 8023 +2098
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Member
Author
|
Upstream reports filed: odoo/odoo#281660 (odoo/odoo#281660) and OCA/OCB#1346 (OCA/OCB#1346). If either lands a proper fix (version guard in odoo/tools/pdf or a setup.py pin), the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
uv pip install --no-depsindocker/Dockerfile. Odoo'ssetup.pydeclares an unpinnedPyPDF2, so the editable install pulled legacy PyPDF2 3.0.1 alongside the pypdf 5.4.0 that OCB'srequirements.txtpins for Python 3.13 (all of Odoo's real dependencies are already installed from that requirements file two layers earlier).odoo/tools/pdfprobes the legacyPyPDF2package beforepypdfwith no version guard, so PyPDF2 3.x won the backend selection — and its removed 1.x API (reader.numPages,getPage) raisesPyPDF2.errors.DeprecationErrorinir.actions.report._render_qweb_pdf_prepare_streamswhenever a report is printed for more than one record (single-record printing skips the split path, which is why it still worked).spp_base_common(test_pdf_backend.py) that exercises the exact legacy split API against the image's selected PDF backend; it fails with the production error on any image that regresses.spp_base_commonto 19.0.2.0.2 with areadme/HISTORY.mdfragment.OpenProject
Test plan
PyPDF2.errors.DeprecationError: reader.numPages ... removed in PyPDF2 3.0.0— identical to the OP#1168 screenshot./spp t spp_base_commonon the rebuilt image — 7 passed, 0 failed, 0 errorsPyPDF2installed;odoo.tools.pdfselects the_pypdfbackend (pypdf 5.4.0)_render_qweb_pdf('base.report_irmodulereference', res_ids=[<3 ids>])in the running dev container returns a valid PDF through wkhtmltopdf + the multi-record split pathPyPDF2directly (grepped/mnt/extra-addonsand the OCA addon trees)Notes
setup.py:52unpinnedPyPDF2contradicts its ownrequirements.txtpin ofPyPDF==5.4.0for py3.13, andodoo/tools/pdf/_pypdf2_2.pyaccepts PyPDF2 3.x without a version guard. Upstream reports to follow; this PR fixes our image regardless.