[FIX] report_qweb_signer: Handle multi-company correctly

pull/615/head
Omar (Comunitea) 2022-02-18 18:47:46 +01:00 committed by Enric Tobella
parent 44c3aa7023
commit 1119f4635b
1 changed files with 2 additions and 5 deletions

View File

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