[MIG] report_qweb_encrypt: Migration to 19.0 - #1188
Merged
Merged
Conversation
Currently translated at 100.0% (11 of 11 strings) Translation: reporting-engine-15.0/reporting-engine-15.0-report_qweb_encrypt Translate-URL: https://translation.odoo-community.org/projects/reporting-engine-15-0/reporting-engine-15-0-report_qweb_encrypt/es/
…m_name reportname is not only a string but also a model or integer, the method _get_report handles those cases to return the report.
…ead of reportname
Currently translated at 100.0% (11 of 11 strings) Translation: reporting-engine-16.0/reporting-engine-16.0-report_qweb_encrypt Translate-URL: https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-report_qweb_encrypt/it/
Changelog:
Controllers:
- Updated `report_download` parameters and reduce nested conditions.
- Decoded URL query parameters safely using
`url_decode(url.split("?", 1)[1])`.
Models:
- Replaced `_()` by `self.env._()`.
- Removed unnecessary intermediate variables.
- Renamed variable `report` to `report_sudo` for clarity on sudoed
record.
Views:
- Replaced `attrs` by individual `invisible` attributes.
Assets:
- Added `EncryptDialog` OWL component to prompt user for encryption
password.
- Implemented `download_function` to handle password injection and PDF
download.
- Refactored report URL building into `buildReportUrl` helper.
- Integrated `EncryptDialog` in `ir.actions.report handlers` registry
under key `qweb-pdf-password`.
- Updated XML template `report_qweb_encrypt.EncryptDialogBody`: added
password input field with `t-ref="password"`, added placeholder for
better UX.
Currently translated at 100.0% (12 of 12 strings) Translation: reporting-engine-18.0/reporting-engine-18.0-report_qweb_encrypt Translate-URL: https://translation.odoo-community.org/projects/reporting-engine-18-0/reporting-engine-18-0-report_qweb_encrypt/it/
Author
|
/ocabot migration report_qweb_encrypt |
Import PdfReader/PdfWriter from odoo.tools.pdf instead of PyPDF2. Odoo 19 pins PyPDF2==2.12.1 only up to python3.12; from python 3.13 (Debian Trixie) it pins PyPDF==5.4.0, where the legacy PdfFileReader/PdfFileWriter names no longer exist: - https://github.com/odoo/odoo/blob/13e9e827dc21103052e8607d16f23c07adeb5634/odoo/tools/pdf/_pypdf.py#L1-L15 Going through odoo.tools.pdf keeps the module working on both backends, since that wrapper already absorbs the difference for core. appendPagesFromReader() is kept on purpose: it is the only spelling available on every backend, the PyPDF2 1.x one does not provide append_pages_from_reader(): - https://github.com/odoo/odoo/blob/13e9e827dc21103052e8607d16f23c07adeb5634/odoo/tools/pdf/_pypdf2_1.py#L28-L33 Replace self._context with self.env.context. In 19.0 the _context property is decorated with @api.deprecated, so every access emits a DeprecationWarning; it still returns self.env.context, but the indirection is scheduled for removal: https://github.com/odoo/odoo/blob/13e9e827dc21103052e8607d16f23c07adeb5634/odoo/orm/models.py#L5921-L5924
moylop260
force-pushed
the
19.0-mig-report_qweb_encrypt
branch
from
August 14, 2026 21:21
a6bb5ce to
64c44de
Compare
controllers/main.py was at 25% coverage: no test reached report_download(), so the manual-password branch was only exercised by hand. Core has no test hitting /report/download either, so these cases are new. The new class inherits odoo.addons.web.tests.test_reports.TestReports, so the core report regression tests also run with this module installed. force_report_rendering is required in the request context: while tests are running _render_qweb_pdf() falls back to _render_qweb_html(), and an html body cannot be encrypted, so without it the encryption branch is never reached: - https://github.com/odoo/odoo/blob/13e9e827dc21103052e8607d16f23c07adeb5634/odoo/addons/base/models/ir_actions_report.py#L1027-L1028 Covered branches: password in the url context, url without query string, context without password, and a non-pdf (qweb-text) response. This takes controllers/main.py from 25.00% to 100.00%, and the module from 70.89% to 97.47%, which is back above the 80% fail-under.
Author
fernandahf
approved these changes
Aug 18, 2026
nhomar
approved these changes
Aug 19, 2026
Author
|
/ocabot merge nobump |
Contributor
|
This PR looks fantastic, let's merge it! |
Contributor
|
Congratulations, your PR was merged at bfca132. Thanks a lot for contributing to OCA. ❤️ |
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.
Import PdfReader/PdfWriter from odoo.tools.pdf instead of PyPDF2.
Odoo 19 pins PyPDF2==2.12.1 only up to python3.12;
from python 3.13 (Debian Trixie) it pins PyPDF==5.4.0,
where the legacy PdfFileReader/PdfFileWriter names no longer exist:
Going through odoo.tools.pdf keeps the module working on both backends,
since that wrapper already absorbs the difference for core.
appendPagesFromReader() is kept on purpose: it is the only spelling available on
every backend, the PyPDF2 1.x one does not provide append_pages_from_reader():
Replace self._context with self.env.context.
In 19.0 the _context property is decorated with @api.deprecated, so every access emits a
DeprecationWarning; it still returns self.env.context, but the indirection is scheduled for removal: