Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions report_qweb_encrypt/models/ir_actions_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def _render_qweb_pdf(self, report_ref, res_ids=None, data=None):
)
report_sudo = self._get_report(report_ref)
if res_ids:
if isinstance(res_ids, int):
res_ids = [res_ids]
encrypt_password = self.env.context.get("encrypt_password")
report = self._get_report_from_name(report_sudo.report_name).with_context(
encrypt_password=encrypt_password
Expand Down
4 changes: 2 additions & 2 deletions report_qweb_encrypt/tests/test_report_qweb_encrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ def test_report_qweb_manual_encrypt(self):
report.encrypt = "manual"

# If no encrypt_password, still not encrypted
pdf, _ = report.with_context(**ctx)._render_qweb_pdf(report.report_name, [1])
pdf, _ = report.with_context(**ctx)._render_qweb_pdf(report.report_name, 1)
self.assertFalse(pdf.count(b"/Encrypt"))

# Valid python string for password
ctx.update({"encrypt_password": "secretcode"})
pdf, _ = report.with_context(**ctx)._render_qweb_pdf(report.report_name, [1])
pdf, _ = report.with_context(**ctx)._render_qweb_pdf(report.report_name, 1)
self.assertTrue(pdf.count(b"/Encrypt"))

# TODO: test_report_qweb_manual_encrypt, require JS test?
Loading