From: Alicia FLOREZ Date: Wed, 29 May 2013 08:40:46 +0000 (+0200) Subject: Modif pour fonctionnement avec semantics : les topics héritent de ceux de semantics X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=d094b3ad38434cdb29b0b3d9c36a3104f93b3770;p=OpenERP%2Ftodolist.git Modif pour fonctionnement avec semantics : les topics héritent de ceux de semantics --- diff --git a/__openerp__.py b/__openerp__.py index 97ea9d8..2e089bd 100644 --- a/__openerp__.py +++ b/__openerp__.py @@ -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.""", diff --git a/todolist.py b/todolist.py index 57adec9..2752280 100644 --- a/todolist.py +++ b/todolist.py @@ -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", - ), - ] diff --git a/views/todolist.xml b/views/todolist.xml index 77f8c70..c7ee99b 100644 --- a/views/todolist.xml +++ b/views/todolist.xml @@ -55,7 +55,7 @@ - +