Modif pour fonctionnement avec semantics : les topics héritent de ceux de semantics
authorAlicia FLOREZ <alicflorez@gmail.com>
Wed, 29 May 2013 08:40:46 +0000 (10:40 +0200)
committerAlicia FLOREZ <alicflorez@gmail.com>
Wed, 29 May 2013 08:40:46 +0000 (10:40 +0200)
__openerp__.py
todolist.py
views/todolist.xml

index 97ea9d8..2e089bd 100644 (file)
@@ -1,7 +1,7 @@
 {
     "name": "TodoList",
     "version": "1.0",
-    "depends": ["base", 'mail', "semantics"],
+    "depends": ["base", "semantics"],
     "author": "Alicia FLOREZ & Sébastien CHAZALLET",
     "category": "Tools",
     "description": """Permet de gérer une 'todo list' personnelle.""",
index 57adec9..2752280 100644 (file)
@@ -5,6 +5,7 @@ from openerp.osv import osv, fields
 
 
 
+# ------------- CONTAINER ------------- #
 class Container(osv.Model):
     """TODO List : Tasks container"""
 
@@ -70,7 +71,12 @@ class Container(osv.Model):
         "manday": fields.function(_get_manday, type="integer", string="Man-Days"),
         "state": fields.selection(_status, string="State", select=True),
         "tasks": fields.one2many("todolist.task", "container_id", string="Tasks"),
-        "topics_id": fields.many2many("todolist.topic", "todolist_container_topic_rel", "container_id", "topic_id", string="Topics", domain=[("activated", "=","Active")]),
+        "topic_ids": fields.many2many("todolist.topic",
+                                      "todolist_container_topic_rel",
+                                      "todolist_ids",
+                                      "topic_ids",
+                                      string="Topics",
+                                      domain=[("activated", "=","Active")]),
         "number_tasks": fields.function(_get_nb_tasks, type="integer", string="Number of tasks"),
         "number_tasks_done": fields.function(_get_nb_tasks_done, type="integer", string="Number of tasks done"),
         "progress_tasks": fields.function(_tasks_progress, type="float", string="Progression"),
@@ -117,6 +123,7 @@ class Container(osv.Model):
         return osv.Model.search(self, cr, user, args, offset, limit, order, context, count)
 
 
+# ------------- TASK ------------- #
 class Task(osv.Model):
     """TODO List : A task (something to do in a to do list)"""
 
@@ -207,7 +214,7 @@ class Task(osv.Model):
             vals["milestone"] = milestone
         return osv.Model.create(self, cr, user, vals, context=context)
 
-
+# ------------- TOPIC ------------- #
 class Topic(osv.Model):
     """TODO List : Container"s Topic"""
 
@@ -241,15 +248,17 @@ class Topic(osv.Model):
 
     _name = "todolist.topic"
 
-    _inherit = "mail.thread"
+    _inherit = "semantics.topic"
 
     _states = [("Active", "Active"), ("Inactive", "Inactive")]
 
     _columns = {
-        "name": fields.char(string="Title", size=64, required=True),
-        "description": fields.text(string="Description"),
         "activated": fields.selection(_states, string="State", select=True),
-        "todolist_ids": fields.many2many("todolist.container", "todolist_container_topic_rel", "topic_id", "Container_id", string="TO DO Lists"),
+        "todolist_ids": fields.many2many("todolist.container",
+                                         "todolist_container_topic_rel",
+                                         "topic_ids",
+                                         "todolist_ids",
+                                         string="TO DO Lists"),
         "nb_lists": fields.function(_get_nb_lists, type="integer", string="Number of lists"),
         "number_tasks": fields.function(_get_number_tasks, type="integer", string="Number of tasks"),
         "number_tasks_done": fields.function(_get_number_tasks_done, type="integer", string="Number of tasks done"),
@@ -259,12 +268,3 @@ class Topic(osv.Model):
     _defaults = {
         "activated": "Active",
     }
-
-
-    _sql_constraints = [
-        (
-            "name_different_from_description_constraint",
-            "CHECK(name <> description)",
-            "Fields name and description should be different",
-        ),
-    ]
index 77f8c70..c7ee99b 100644 (file)
@@ -55,7 +55,7 @@
                             </page>
                             <page string="Topics">
                                 <group colspan="4" col="1">
-                                    <field name="topics_id"/>
+                                    <field name="topic_ids"/>
                                 </group>
                             </page>
                         </notebook>