# HG changeset patch
# Parent a6fe4d3923db1f8f5dff2c39a711a814b0a0f549
# Parent 0687e07f570f363bf5005c6337e0c565a63a6bac
diff --git a/openacademy/models.py b/openacademy/models.py
--- a/openacademy/models.py
+++ b/openacademy/models.py
@@ -62,6 +62,9 @@ class Session(models.Model):
hours = fields.Float(string="Duration in hours",
compute='_get_hours', inverse='_set_hours')
+ attendees_count = fields.Integer(
+ string="Attendees count", compute='_get_attendees_count', store=True)
+
@api.depends('seats', 'attendee_ids')
def _taken_seats(self):
for r in self:
@@ -120,6 +123,11 @@ class Session(models.Model):
for r in self:
r.duration = r.hours / 24
+ @api.depends('attendee_ids')
+ def _get_attendees_count(self):
+ for r in self:
+ r.attendees_count = len(r.attendee_ids)
+
@api.constrains('instructor_id', 'attendee_ids')
def _check_instructor_not_in_attendees(self):
for r in self:
diff --git a/openacademy/views/openacademy.xml b/openacademy/views/openacademy.xml
--- a/openacademy/views/openacademy.xml
+++ b/openacademy/views/openacademy.xml
@@ -157,11 +157,22 @@
+
+ openacademy.session.graph
+ openacademy.session
+
+
+
+
+
+
+
+
Sessions
openacademy.session
form
- tree,form,calendar,gantt
+ tree,form,calendar,gantt,graph