From 2ad092b5e54fa39a906b38d9240e08b9800ea0da Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Fri, 22 Aug 2014 17:51:20 +0200 Subject: [ADD] doc: new documentation, with training tutorials, and new scaffolding --- doc/howtos/backend/exercise-constraint-python | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 doc/howtos/backend/exercise-constraint-python (limited to 'doc/howtos/backend/exercise-constraint-python') diff --git a/doc/howtos/backend/exercise-constraint-python b/doc/howtos/backend/exercise-constraint-python new file mode 100644 index 00000000000..c2f0b8a6114 --- /dev/null +++ b/doc/howtos/backend/exercise-constraint-python @@ -0,0 +1,24 @@ +# HG changeset patch +# Parent 7a7d003fe38426a405ce0657a627a139133ec4dd + +Index: doc-backend/openacademy/course.py +=================================================================== +--- doc-backend.orig/openacademy/course.py 2014-08-22 17:02:00.987103191 +0200 ++++ doc-backend/openacademy/course.py 2014-08-22 17:02:00.983103191 +0200 +@@ -1,5 +1,5 @@ + # -*- coding: utf-8 -*- +-from openerp import api, fields, models ++from openerp import api, fields, models, exceptions + + class Course(models.Model): + _name = 'openacademy.course' +@@ -56,3 +56,9 @@ + }, + } + ++ @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") ++ -- cgit v1.2.3 From 2b3b1c3230ac0aaa58a22664c278b910b1611191 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Sun, 24 Aug 2014 13:06:51 +0200 Subject: [IMP] doc/howtos/backend: use scaffolding and adapt text and code accordingly --- doc/howtos/backend/exercise-constraint-python | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'doc/howtos/backend/exercise-constraint-python') diff --git a/doc/howtos/backend/exercise-constraint-python b/doc/howtos/backend/exercise-constraint-python index c2f0b8a6114..a3a18d4e617 100644 --- a/doc/howtos/backend/exercise-constraint-python +++ b/doc/howtos/backend/exercise-constraint-python @@ -1,24 +1,25 @@ # HG changeset patch # Parent 7a7d003fe38426a405ce0657a627a139133ec4dd -Index: doc-backend/openacademy/course.py +Index: doc-backend/openacademy/models.py =================================================================== ---- doc-backend.orig/openacademy/course.py 2014-08-22 17:02:00.987103191 +0200 -+++ doc-backend/openacademy/course.py 2014-08-22 17:02:00.983103191 +0200 -@@ -1,5 +1,5 @@ +--- doc-backend.orig/openacademy/models.py 2014-08-24 12:16:56.413385666 +0200 ++++ doc-backend/openacademy/models.py 2014-08-24 12:17:11.137386006 +0200 +@@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- --from openerp import api, fields, models -+from openerp import api, fields, models, exceptions + +-from openerp import models, fields, api ++from openerp import models, fields, api, exceptions class Course(models.Model): _name = 'openacademy.course' @@ -56,3 +56,9 @@ + '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") -+ -- cgit v1.2.3 From 436fa8490a1539a3c85f9fd4f5c4f5067e0ae54d Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Tue, 26 Aug 2014 17:28:29 +0200 Subject: [IMP] doc/howtos/backend: improve views, fix workflow --- doc/howtos/backend/exercise-constraint-python | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'doc/howtos/backend/exercise-constraint-python') diff --git a/doc/howtos/backend/exercise-constraint-python b/doc/howtos/backend/exercise-constraint-python index a3a18d4e617..9818fe8d395 100644 --- a/doc/howtos/backend/exercise-constraint-python +++ b/doc/howtos/backend/exercise-constraint-python @@ -1,10 +1,10 @@ # HG changeset patch # Parent 7a7d003fe38426a405ce0657a627a139133ec4dd -Index: doc-backend/openacademy/models.py +Index: addons/openacademy/models.py =================================================================== ---- doc-backend.orig/openacademy/models.py 2014-08-24 12:16:56.413385666 +0200 -+++ doc-backend/openacademy/models.py 2014-08-24 12:17:11.137386006 +0200 +--- 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 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -- cgit v1.2.3