+ for container in self.browse(cr, uid, ids, context=context):
+ result[container.id] = len(container.tasks)
+ return result
+# return dict((c.id, len(c.tasks)) for c in self.browse(cr, uid, ids, context=context))
+
+
+ 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] = done/total
+ return result
+
+
+ def _task_progress2(self, cr, uid, ids, field, arg, context=None):
+ result = {}
+ for container in self.browse(cr, uid, ids, context=context):
+ tasks = container.tasks
+ total = len(tasks)
+ done = len([t for t in tasks if t.state == "done"])
+ result[container.id] = done/total*100.