[IMP] report_qweb_signer: Signature visible parameter not include by default and fix multicompany issue

This commit is contained in:
Omar (Comunitea)
2021-11-02 19:07:43 +01:00
parent 629a76dd67
commit f697543148
3 changed files with 13 additions and 5 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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'.