* alter docstring of @api.one to mark it as deprecated for 9.0,
recommend using @api.multi instead
- deprecation notes were not correctly styled, add styling
matching "warning" alerts
* move @api.one down the doc page to deemphasize it
* fix "backend" tutorial to remove all instances of ``@api.one``
closes #8527
26 lines
898 B
Plaintext
26 lines
898 B
Plaintext
# HG changeset patch
|
|
# Parent 7a7d003fe38426a405ce0657a627a139133ec4dd
|
|
# Parent 52f54b46487c8224a5aade4b921be77360ed3eae
|
|
|
|
diff --git a/openacademy/models.py b/openacademy/models.py
|
|
--- a/openacademy/models.py
|
|
+++ b/openacademy/models.py
|
|
@@ -1,6 +1,6 @@
|
|
# -*- coding: utf-8 -*-
|
|
|
|
-from openerp import models, fields, api
|
|
+from openerp import models, fields, api, exceptions
|
|
|
|
class Course(models.Model):
|
|
_name = 'openacademy.course'
|
|
@@ -56,3 +56,9 @@ class Session(models.Model):
|
|
'message': "Increase seats or remove excess attendees",
|
|
},
|
|
}
|
|
+
|
|
+ @api.constrains('instructor_id', 'attendee_ids')
|
|
+ def _check_instructor_not_in_attendees(self):
|
|
+ for r in self:
|
|
+ if r.instructor_id and r.instructor_id in r.attendee_ids:
|
|
+ raise exceptions.ValidationError("A session's instructor can't be an attendee")
|