Ajout contrainte pour taches : name <> description
authorAlicia FLOREZ <alicflorez@gmail.com>
Thu, 21 Mar 2013 16:24:00 +0000 (17:24 +0100)
committerAlicia FLOREZ <alicflorez@gmail.com>
Thu, 21 Mar 2013 16:24:00 +0000 (17:24 +0100)
todolist.py

index a25878f..0209a9b 100644 (file)
@@ -128,6 +128,15 @@ class Task(osv.Model):
 
     _order = "planned"
 
+    _sql_constraints = [
+        (
+            "name_different_from_description_constraint",
+            "CHECK(name <> description)",
+            "Fields name and description should be different",
+        ),
+    ]
+
+
     def action_draft(self, cr, uid, ids, context=None):
         self.write(cr, uid, ids, {"state": "draft"}, context=context)
         return self