From: Alicia FLOREZ Date: Wed, 20 Mar 2013 15:08:17 +0000 (+0100) Subject: Ajout du nombre de list pour les topics X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=0be1c32c67902394207fbde3fa41b95e4476ca5b;p=OpenERP%2Ftodolist.git Ajout du nombre de list pour les topics --- diff --git a/todolist.py b/todolist.py index fee9aea..a919d15 100644 --- a/todolist.py +++ b/todolist.py @@ -153,6 +153,13 @@ class Task(osv.Model): class Topic(osv.Model): """TODO List : Container"s Topic""" + def _get_nb_lists(self, cr, uid, ids, field, arg, context=None): + result = {} + for topic in self.browse(cr, uid, ids, context=context): + result[topic.id] = len(topic.todolist_ids) + return result + + _name = "todolist.topic" _states = [("Active", "Active"), ("Inactive", "Inactive")] @@ -162,6 +169,7 @@ class Topic(osv.Model): "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"), + "nb_lists": fields.function(_get_nb_lists, type="integer", string="Number of lists"), } _defaults = { diff --git a/views/todolist.xml b/views/todolist.xml index c638e92..6e84165 100644 --- a/views/todolist.xml +++ b/views/todolist.xml @@ -78,6 +78,8 @@