diff --git a/models/coworker.py b/models/coworker.py
index 3c3006f..87e0b63 100644
--- a/models/coworker.py
+++ b/models/coworker.py
@@ -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):
diff --git a/models/event.py b/models/event.py
index 7e76fea..b5a68f5 100644
--- a/models/event.py
+++ b/models/event.py
@@ -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):
diff --git a/views/coworker_views.xml b/views/coworker_views.xml
index 7c5cbff..91ff0bd 100644
--- a/views/coworker_views.xml
+++ b/views/coworker_views.xml
@@ -42,6 +42,7 @@
+