Skip to content

Syncing from upstream OCA/reporting-engine (19.0) - #954

Merged
bt-admin merged 25 commits into
brain-tec:19.0from
OCA:19.0
Aug 20, 2026
Merged

bt-admin merged 25 commits into
brain-tec:19.0from
OCA:19.0

Conversation

@bt-admin

Copy link
Copy Markdown

bt_gitbot

etobella and others added 25 commits August 14, 2026 19:45
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.
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/
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
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.
Signed-off-by moylop260
@bt-admin bt-admin added the 19.0 label Aug 20, 2026
@bt-admin
bt-admin merged commit ea78309 into brain-tec:19.0 Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.