diff --git a/report_qweb_encrypt/models/ir_actions_report.py b/report_qweb_encrypt/models/ir_actions_report.py index 8114c7f0b8..1313688136 100644 --- a/report_qweb_encrypt/models/ir_actions_report.py +++ b/report_qweb_encrypt/models/ir_actions_report.py @@ -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 diff --git a/report_qweb_encrypt/tests/test_report_qweb_encrypt.py b/report_qweb_encrypt/tests/test_report_qweb_encrypt.py index 2095531c1d..d99a53c118 100644 --- a/report_qweb_encrypt/tests/test_report_qweb_encrypt.py +++ b/report_qweb_encrypt/tests/test_report_qweb_encrypt.py @@ -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?