forked from michel/Coworking
[IMP]Event model cleaning + search function handling of operator and value
This commit is contained in:
parent
168f28d0c9
commit
663219440c
@ -24,13 +24,11 @@ class Event(models.Model):
|
|||||||
description = fields.Text()
|
description = fields.Text()
|
||||||
statut = fields.Selection([('draft', 'Draft'),
|
statut = fields.Selection([('draft', 'Draft'),
|
||||||
('confirmed', 'Confirmed'),
|
('confirmed', 'Confirmed'),
|
||||||
('canceled', 'Canceled')], default='canceled')
|
('canceled', 'Canceled')], default='draft')
|
||||||
|
|
||||||
participants_ids = fields.Many2many('coworking.coworker', string='Subscribers')
|
participants_ids = fields.Many2many('coworking.coworker', string='Subscribers')
|
||||||
participants_count = fields.Integer('Number of participants',
|
participants_count = fields.Integer('Number of participants',
|
||||||
compute='_compute_participants_count')
|
compute='_compute_participants_count')
|
||||||
participants_count2 = fields.Integer('Number of participants #2',
|
|
||||||
compute='_compute_participants_count')
|
|
||||||
|
|
||||||
@api.depends('date_start')
|
@api.depends('date_start')
|
||||||
def _compute_starts_this_week(self):
|
def _compute_starts_this_week(self):
|
||||||
@ -48,7 +46,11 @@ class Event(models.Model):
|
|||||||
week_start = date_start.isocalendar()[1]
|
week_start = date_start.isocalendar()[1]
|
||||||
if datetime.now().isocalendar()[1] == week_start:
|
if datetime.now().isocalendar()[1] == week_start:
|
||||||
res_ids.append(event.id)
|
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')
|
@api.depends('participants_ids')
|
||||||
def _compute_participants_count(self):
|
def _compute_participants_count(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user