From a8c998a9cfd18dc474eeafbe7f28fdb9b0642c0a Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Thu, 10 Aug 2023 15:04:09 +0200 Subject: [PATCH] [IMP] sign_oca: various fixes --- sign_oca/models/sign_oca_template.py | 9 ++++++++- sign_oca/views/sign_oca_request.xml | 8 ++++++++ sign_oca/views/sign_oca_template.xml | 13 ++++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/sign_oca/models/sign_oca_template.py b/sign_oca/models/sign_oca_template.py index 48d8e50c..cfa2fecb 100644 --- a/sign_oca/models/sign_oca_template.py +++ b/sign_oca/models/sign_oca_template.py @@ -13,6 +13,13 @@ class SignOcaTemplate(models.Model): data = fields.Binary(attachment=True, required=True) filename = fields.Char() item_ids = fields.One2many("sign.oca.template.item", inverse_name="template_id") + request_count = fields.Integer(compute="_compute_request_count") + request_ids = fields.One2many("sign.oca.request", inverse_name="template_id") + + @api.depends("request_ids") + def _compute_request_count(self): + for record in self: + record.request_count = len(record.request_ids) def configure(self): self.ensure_one() @@ -69,7 +76,7 @@ class SignOcaTemplateItem(models.Model): role_id = fields.Many2one("sign.oca.role", default=lambda r: r._get_default_role()) required = fields.Boolean() # If no role, it will be editable by everyone... - page = fields.Integer(required=True) + page = fields.Integer(required=True, default=1) position_x = fields.Float(required=True) position_y = fields.Float(required=True) width = fields.Float() diff --git a/sign_oca/views/sign_oca_request.xml b/sign_oca/views/sign_oca_request.xml index 1d4275df..ca43f81c 100644 --- a/sign_oca/views/sign_oca_request.xml +++ b/sign_oca/views/sign_oca_request.xml @@ -294,6 +294,14 @@ {} + + Sign Requests + sign.oca.request + kanban,tree,form + [('template_id', '=', active_id)] + {} + + Requests diff --git a/sign_oca/views/sign_oca_template.xml b/sign_oca/views/sign_oca_template.xml index a2bb878c..e65c42e5 100644 --- a/sign_oca/views/sign_oca_template.xml +++ b/sign_oca/views/sign_oca_template.xml @@ -19,11 +19,22 @@ icon="fa-wrench" string="Configure" /> +