From: Alicia FLOREZ Date: Wed, 20 Mar 2013 16:42:06 +0000 (+0100) Subject: Ajout progression des taches par topics X-Git-Url: http://git.inspyration.org/?p=OpenERP%2Ftodolist.git;a=commitdiff_plain;h=e1c7146ceadfca7913da7e8cbf7ccf91ad517487 Ajout progression des taches par topics --- diff --git a/todolist.py b/todolist.py index e55a2c0..9c0ee61 100644 --- a/todolist.py +++ b/todolist.py @@ -166,6 +166,13 @@ class Topic(osv.Model): return result + def _progress_tasks(self, cr, uid, ids, field, arg, context=None): + result = {} + for topic in self.browse(cr, uid, ids, context=context): + result[topic.id] = topic.number_tasks and topic.number_tasks_done*100./topic.number_tasks or 0. + return result + + _name = "todolist.topic" _states = [("Active", "Active"), ("Inactive", "Inactive")] @@ -178,6 +185,7 @@ class Topic(osv.Model): "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 lists"), "number_tasks_done": fields.function(_get_number_tasks_done, type="integer", string="Number of lists"), + "progress_tasks": fields.function(_progress_tasks, type="float", string="Number of lists"), } _defaults = { diff --git a/views/todolist.xml b/views/todolist.xml index 815e892..be81254 100644 --- a/views/todolist.xml +++ b/views/todolist.xml @@ -82,6 +82,7 @@