diff options
Diffstat (limited to 'addons/project/project.py')
| -rw-r--r-- | addons/project/project.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/addons/project/project.py b/addons/project/project.py index e9dc6c06508..ecfb8f0b975 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -112,6 +112,14 @@ class project(osv.osv): for project in self.browse(cr, uid, ids, context=context): res[project.id] = len(project.task_ids) return res + + def _task_needaction_count(self, cr, uid, ids, field_name, arg, context=None): + Task = self.pool['project.task'] + res = dict.fromkeys(ids, 0) + projects = Task.read_group(cr, uid, [('project_id', 'in', ids), ('message_needaction', '=', True)], ['project_id'], ['project_id'], context=context) + res.update({project['project_id'][0]: int(project['project_id_count']) for project in projects}) + return res + def _get_alias_models(self, cr, uid, context=None): """ Overriden in project_issue to offer more options """ return [('project.task', "Tasks")] @@ -163,6 +171,7 @@ class project(osv.osv): 'resource_calendar_id': fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report", states={'close':[('readonly',True)]} ), 'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), 'task_count': fields.function(_task_count, type='integer', string="Tasks",), + 'task_needaction_count': fields.function(_task_needaction_count, type='integer', string="Tasks",), 'task_ids': fields.one2many('project.task', 'project_id', domain=['|', ('stage_id.fold', '=', False), ('stage_id', '=', False)]), 'color': fields.integer('Color Index'), |
