[FIX] report_qweb_signer: Fix when report is printed without related objects (print from wizard in some cases)

pull/615/head
Omar (Comunitea) 2021-11-04 23:44:00 +01:00 committed by Enric Tobella
parent 4d2b04c281
commit 44c3aa7023
1 changed files with 5 additions and 5 deletions

View File

@ -39,11 +39,11 @@ class IrActionsReport(models.Model):
"""Obtain the proper certificate for the report and the conditions.""" """Obtain the proper certificate for the report and the conditions."""
if self.report_type != "qweb-pdf": if self.report_type != "qweb-pdf":
return False return False
obj = self.env[self.model].browse(res_ids[0]) company_id = self.env.user.company_id.id
if "company_id" in obj: if res_ids:
company_id = obj.company_id.id obj = self.env[self.model].browse(res_ids[0])
else: if "company_id" in obj:
company_id = self.env.user.company_id.id company_id = obj.company_id.id
certificates = self.env["report.certificate"].search( certificates = self.env["report.certificate"].search(
[ [
("company_id", "=", company_id), ("company_id", "=", company_id),