diff --git a/golem_activity_queue/models/golem_activity.py b/golem_activity_queue/models/golem_activity.py index 53343ee..dfa4bd2 100644 --- a/golem_activity_queue/models/golem_activity.py +++ b/golem_activity_queue/models/golem_activity.py @@ -24,20 +24,27 @@ class GolemActivity(models.Model): #ajout d'un champs O2M vers activity_id - activity_queue_id = fields.One2many('golem.activity.queue', 'activity_id') + activity_queue_ids = fields.One2many('golem.activity.queue', 'activity_id') # un boolen pour determiner si une fille d'attente est autorisé queue_allowed = fields.Boolean(default=True) + @api.multi def queue_register(self): + self.ensure_one() + activity_id = self[0] return { 'name' : _('Register in the queue'), 'type' : 'ir.actions.act_window', 'res_model' : 'golem.activity.queue', - 'view_mode': 'tree,form', + 'context' :{'default_activity_id' : activity_id.id}, + 'domain' : [('activity_id', '=', activity_id.id)],# activity_id.name)],#"('activity_id', '=', True)" + 'view_mode': 'tree', 'flags': {'action_buttons': True}, 'target': 'new', } + + @api.onchange('activity_registration_ids') def _checkRemain(self): if len(self.activity_registration_ids) > self.places and self.queue_allowed: diff --git a/golem_activity_queue/models/golem_activity_queue.py b/golem_activity_queue/models/golem_activity_queue.py index f668522..aa19c65 100644 --- a/golem_activity_queue/models/golem_activity_queue.py +++ b/golem_activity_queue/models/golem_activity_queue.py @@ -54,6 +54,8 @@ class GolemActivityQueue(models.Model): activity_id = fields.Many2one('golem.activity', required=True) season_id = fields.Many2one(related='activity_id.season_id') member_id = fields.Many2one('golem.member', required=True) + is_current = fields.Boolean('Current season?', + related='activity_id.is_current', store=True) def call_up_wizard(self): return { diff --git a/golem_activity_queue/views/golem_activity_queue_views.xml b/golem_activity_queue/views/golem_activity_queue_views.xml index 3522e0a..e286550 100644 --- a/golem_activity_queue/views/golem_activity_queue_views.xml +++ b/golem_activity_queue/views/golem_activity_queue_views.xml @@ -44,9 +44,10 @@ along with this program. If not, see . golem.activity.queue - - + + +