diff options
| author | Xavier Morel <xmo@odoo.com> | 2015-09-14 16:30:06 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2015-09-15 14:38:45 +0200 |
| commit | 2474a91bc9ce6c0e72fb6d6eaad81610a8b1ac24 (patch) | |
| tree | 2bf825cf87d1e131d95bd4ae163089c10ac6479d /doc/howtos/backend/exercise-constraint-python | |
| parent | f627199def8c349a6f6c37c96ab99b13792aabc8 (diff) | |
[IMP] doc: recommend not using @api.one
* 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
Diffstat (limited to 'doc/howtos/backend/exercise-constraint-python')
| -rw-r--r-- | doc/howtos/backend/exercise-constraint-python | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/doc/howtos/backend/exercise-constraint-python b/doc/howtos/backend/exercise-constraint-python index 9818fe8d395..290e09aa5a1 100644 --- a/doc/howtos/backend/exercise-constraint-python +++ b/doc/howtos/backend/exercise-constraint-python @@ -1,10 +1,10 @@ # HG changeset patch # Parent 7a7d003fe38426a405ce0657a627a139133ec4dd +# Parent 52f54b46487c8224a5aade4b921be77360ed3eae -Index: addons/openacademy/models.py -=================================================================== ---- addons.orig/openacademy/models.py 2014-08-26 17:26:06.591783274 +0200 -+++ addons/openacademy/models.py 2014-08-26 17:26:06.587783274 +0200 +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 -*- @@ -13,13 +13,13 @@ Index: addons/openacademy/models.py class Course(models.Model): _name = 'openacademy.course' -@@ -56,3 +56,9 @@ +@@ -56,3 +56,9 @@ class Session(models.Model): 'message': "Increase seats or remove excess attendees", }, } + -+ @api.one + @api.constrains('instructor_id', 'attendee_ids') + def _check_instructor_not_in_attendees(self): -+ if self.instructor_id and self.instructor_id in self.attendee_ids: -+ raise exceptions.ValidationError("A session's instructor can't be an attendee") ++ 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") |
