From 321b25661af76a7cf3824a85426e6f2a651bc58e Mon Sep 17 00:00:00 2001 From: eloyoussef Date: Tue, 20 Feb 2018 13:01:04 +0100 Subject: [PATCH] add queue register function to member model --- golem_activity_queue/models/golem_activity.py | 6 +++--- golem_activity_queue/models/golem_member.py | 10 ++++++++++ .../views/golem_activity_queue_views.xml | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/golem_activity_queue/models/golem_activity.py b/golem_activity_queue/models/golem_activity.py index cf35b4e..53343ee 100644 --- a/golem_activity_queue/models/golem_activity.py +++ b/golem_activity_queue/models/golem_activity.py @@ -33,13 +33,13 @@ class GolemActivity(models.Model): 'name' : _('Register in the queue'), 'type' : 'ir.actions.act_window', 'res_model' : 'golem.activity.queue', - 'view_mode': 'form', - 'view_type': 'form', + 'view_mode': 'tree,form', + 'flags': {'action_buttons': True}, 'target': 'new', } @api.onchange('activity_registration_ids') - def _checkRemain(self): + def _checkRemain(self): if len(self.activity_registration_ids) > self.places and self.queue_allowed: return { 'warning' : { diff --git a/golem_activity_queue/models/golem_member.py b/golem_activity_queue/models/golem_member.py index fd98685..7b22394 100644 --- a/golem_activity_queue/models/golem_member.py +++ b/golem_activity_queue/models/golem_member.py @@ -31,3 +31,13 @@ class GolemMember(models.Model): 'message': _('No remaining place, please register in the queue'), } } + + def queue_register(self): + return { + 'name' : _('Register in the queue'), + 'type' : 'ir.actions.act_window', + 'res_model' : 'golem.activity.queue', + 'view_mode': 'tree', + 'flags': {'action_buttons': True}, + 'target': 'new', + } diff --git a/golem_activity_queue/views/golem_activity_queue_views.xml b/golem_activity_queue/views/golem_activity_queue_views.xml index a2cff8b..3522e0a 100644 --- a/golem_activity_queue/views/golem_activity_queue_views.xml +++ b/golem_activity_queue/views/golem_activity_queue_views.xml @@ -43,7 +43,7 @@ along with this program. If not, see . queue.tree golem.activity.queue - +