From f6975431489c51c2fce1d4c39af97121b973420d Mon Sep 17 00:00:00 2001 From: "Omar (Comunitea)" Date: Tue, 2 Nov 2021 19:07:43 +0100 Subject: [PATCH] [IMP] report_qweb_signer: Signature visible parameter not include by default and fix multicompany issue --- report_qweb_signer/models/ir_actions_report.py | 11 +++++++---- report_qweb_signer/readme/INSTALL.rst | 2 +- report_qweb_signer/readme/USAGE.rst | 5 +++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/report_qweb_signer/models/ir_actions_report.py b/report_qweb_signer/models/ir_actions_report.py index ea9108fda..349d101ab 100644 --- a/report_qweb_signer/models/ir_actions_report.py +++ b/report_qweb_signer/models/ir_actions_report.py @@ -38,9 +38,14 @@ class IrActionsReport(models.Model): """Obtain the proper certificate for the report and the conditions.""" if self.report_type != "qweb-pdf": return False + obj = self.env[self.model].browse(res_ids[0]) + if "company_id" in obj: + company_id = obj.company_id.id + else: + company_id = self.env.user.company_id.id certificates = self.env["report.certificate"].search( [ - ("company_id", "=", self.env.user.company_id.id), + ("company_id", "=", company_id), ("model_id", "=", self.model), ] ) @@ -176,9 +181,7 @@ class IrActionsReport(models.Model): passwd_f = open(passwd, "tr") passwd = passwd_f.read().strip() passwd_f.close() - signer_opts = ' "{}" -ksf "{}" -ksp "{}" -V -d "/tmp"'.format( - pdf, p12, passwd - ) + signer_opts = ' "{}" -ksf "{}" -ksp "{}" -d "/tmp"'.format(pdf, p12, passwd) signer = self._signer_bin(signer_opts) process = subprocess.Popen( signer, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True diff --git a/report_qweb_signer/readme/INSTALL.rst b/report_qweb_signer/readme/INSTALL.rst index fe6dc712b..e6018cf41 100644 --- a/report_qweb_signer/readme/INSTALL.rst +++ b/report_qweb_signer/readme/INSTALL.rst @@ -1,3 +1,3 @@ To install this module, you need to install Java JDK Headlees, e.g.: - apt-get install openjdk-8-jre-headless + apt-get install default-jre-headless diff --git a/report_qweb_signer/readme/USAGE.rst b/report_qweb_signer/readme/USAGE.rst index 068f66e92..641c84f81 100644 --- a/report_qweb_signer/readme/USAGE.rst +++ b/report_qweb_signer/readme/USAGE.rst @@ -8,3 +8,8 @@ when signing date is important, for example, when signing customer invoices. You can try the signing with the demo report that is included for customers called "Test PDF certificate". + +You can set extra parameters of JSignPdf library in the system parameter +named 'report_qweb_signer.java_position_parameters', for example '-V' to +visible signature into pdf. You can also set extra parameters for Java in the +system parameter named 'report_qweb_signer.java_parameters'.