diff --git a/models/event.py b/models/event.py index 07a3b51..e6ef7a6 100644 --- a/models/event.py +++ b/models/event.py @@ -24,13 +24,11 @@ class Event(models.Model): description = fields.Text() statut = fields.Selection([('draft', 'Draft'), ('confirmed', 'Confirmed'), - ('canceled', 'Canceled')], default='canceled') + ('canceled', 'Canceled')], default='draft') participants_ids = fields.Many2many('coworking.coworker', string='Subscribers') participants_count = fields.Integer('Number of participants', compute='_compute_participants_count') - participants_count2 = fields.Integer('Number of participants #2', - compute='_compute_participants_count') @api.depends('date_start') def _compute_starts_this_week(self): @@ -48,7 +46,11 @@ class Event(models.Model): week_start = date_start.isocalendar()[1] if datetime.now().isocalendar()[1] == week_start: res_ids.append(event.id) - return [('id', 'in', res_ids)] + if operator == '=': + operator = 'in'if value else 'not in' + else: + operator = 'not in'if value else 'in' + return [('id', operator, res_ids)] @api.depends('participants_ids') def _compute_participants_count(self):