Spécifications v2: Il nous manque le nombre d'événements auquel le coworker a participé

This commit is contained in:
michel 2017-11-15 12:31:47 +01:00
parent 545749ac50
commit ffd1399e67
3 changed files with 11 additions and 5 deletions

View File

@ -47,6 +47,16 @@ class Coworker(models.Model):
string='Events managed')
event_ids = fields.Many2many('coworking.event', string='Events visited')
events_coworker_count = fields.Integer('Number of event have participe',
compute='_compute_events_coworker_count')
@api.depends('event_ids')
def _compute_events_coworker_count(self):
""" Computes number of event coworker """
for event in self:
event.events_coworker_count = len(event.event_ids)
@api.depends('name', 'firstname')
def _compute_full_name(self):

View File

@ -31,11 +31,6 @@ class Event(models.Model):
compute='_compute_participants_count')
@api.depends('participants_ids')
def _compute_participants_count(self):
""" Computes number of participants """
for event in self:
event.participants_count = len(event.participants_ids)
@api.depends('date_start')
def _compute_starts_this_week(self):

View File

@ -42,6 +42,7 @@
<field name="manager_event_ids"
context="{'default_manager_id': active_id}" />
<field name="event_ids" />
<field name="events_coworker_count" />
</group>
</page>
</notebook>