Nettoyage && search function sur le modèle des événements #2

Merged
michel merged 1 commits from fabien/michel_coworking:V2 into V2 2017-11-15 09:56:03 +01:00

View File

@ -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):