-
- def _task_progress(self, cr, uid, ids, field, arg, context=None):
- result = {}
- for container in self.browse(cr, uid, ids, context=context):
- done = total = 0
- for task in container.tasks.browse(cr, uid, ids, context=context):
- total += 1
- if task.state == "done":
- done += 1
- result[container.id] = total and done/total or 0.
+ def _get_nb_tasks_done(self, cr, uid, ids, field, arg, context=None):
+ result={}
+ for c in self.browse(cr, uid, ids, context=context):
+ result[c.id] = len([t for t in c.tasks if t.state == "done"])