[IMP] report_qweb_signer: allowed reports on certificate
Add a new 'Allowed reports' field on the certificate. Only reports listed in this field can be signed. No report means all reports are allowed.pull/533/head
parent
4ef772e146
commit
da193fd9fd
|
@ -45,7 +45,13 @@ class IrActionsReport(models.Model):
|
||||||
if "company_id" in obj:
|
if "company_id" in obj:
|
||||||
company_id = obj.company_id.id or company_id
|
company_id = obj.company_id.id or company_id
|
||||||
certificates = self.env["report.certificate"].search(
|
certificates = self.env["report.certificate"].search(
|
||||||
[("company_id", "=", company_id), ("model_id", "=", self.model)]
|
[
|
||||||
|
("company_id", "=", company_id),
|
||||||
|
("model_id", "=", self.model),
|
||||||
|
"|",
|
||||||
|
("action_report_ids", "=", False),
|
||||||
|
("action_report_ids", "in", self.id),
|
||||||
|
]
|
||||||
)
|
)
|
||||||
if not certificates:
|
if not certificates:
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -36,6 +36,16 @@ class ReportCertificate(models.Model):
|
||||||
domain = fields.Char(
|
domain = fields.Char(
|
||||||
string="Domain", help="Domain for filtering if sign or not the document",
|
string="Domain", help="Domain for filtering if sign or not the document",
|
||||||
)
|
)
|
||||||
|
action_report_ids = fields.Many2many(
|
||||||
|
string="Allowed reports",
|
||||||
|
help="Reports to sign for the selected model."
|
||||||
|
"No report selected means all reports are allowed.",
|
||||||
|
comodel_name="ir.actions.report",
|
||||||
|
relation="report_certificate_action_report",
|
||||||
|
column1="report_certificate_id",
|
||||||
|
column2="action_report_id",
|
||||||
|
domain="[('model_id', '=', model_id)]",
|
||||||
|
)
|
||||||
allow_only_one = fields.Boolean(
|
allow_only_one = fields.Boolean(
|
||||||
string="Allow only one document",
|
string="Allow only one document",
|
||||||
default=True,
|
default=True,
|
||||||
|
|
|
@ -33,6 +33,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
widget="selection"
|
widget="selection"
|
||||||
groups="base.group_multi_company"
|
groups="base.group_multi_company"
|
||||||
/>
|
/>
|
||||||
|
<field name="action_report_ids" widget="many2many_tags" />
|
||||||
</group>
|
</group>
|
||||||
<group
|
<group
|
||||||
attrs="{'invisible': [('signing_method', '!=', 'endesive')]}"
|
attrs="{'invisible': [('signing_method', '!=', 'endesive')]}"
|
||||||
|
|
Loading…
Reference in New Issue