diff --git a/addons/project/project.py b/addons/project/project.py index 5c234cf5e26..8688f4ebc9b 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -920,21 +920,24 @@ class task(osv.osv): self.log(cr, uid, id, message) return True - def set_remaining_time_1(self, cr, uid, ids, context=None): - self.write(cr, uid, ids, {'remaining_hours': 1.0}, context=context) + def set_remaining_time(self, cr, uid, ids, remaining_time=1.0, context=None): + for task in self.browse(cr, uid, ids, context=context): + if (task.state=='draft') or (task.planned_hours==0.0): + self.write(cr, uid, [task.id], {'planned_hours': remaining_time}, context=context) + self.write(cr, uid, ids, {'remaining_hours': remaining_time}, context=context) return True + def set_remaining_time_1(self, cr, uid, ids, context=None): + return self.set_remaining_time(cr, uid, ids, 1.0, context) + def set_remaining_time_2(self, cr, uid, ids, context=None): - self.write(cr, uid, ids, {'remaining_hours': 2.0}, context=context) - return True + return self.set_remaining_time(cr, uid, ids, 2.0, context) def set_remaining_time_5(self, cr, uid, ids, context=None): - self.write(cr, uid, ids, {'remaining_hours': 5.0}, context=context) - return True + return self.set_remaining_time(cr, uid, ids, 5.0, context) def set_remaining_time_10(self, cr, uid, ids, context=None): - self.write(cr, uid, ids, {'remaining_hours': 10.0}, context=context) - return True + return self.set_remaining_time(cr, uid, ids, 10.0, context) def set_kanban_state_blocked(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'kanban_state': 'blocked'}, context=context) @@ -979,6 +982,7 @@ class task(osv.osv): self.pool.get('project.task.history').create(cr, uid, { 'task_id': task.id, 'remaining_hours': task.remaining_hours, + 'planned_hours': task.planned_hours, 'kanban_state': task.kanban_state, 'type_id': task.type_id.id, 'state': task.state, @@ -1158,7 +1162,8 @@ class project_task_history(osv.osv): 'end_date': fields.function(_get_date, string='End Date', type="date", store={ 'project.task.history': (_get_related_date, None, 20) }), - 'remaining_hours': fields.float('Remaining Hours', digits=(16,2)), + 'remaining_hours': fields.float('Remaining Time', digits=(16,2)), + 'planned_hours': fields.float('Planned Time', digits=(16,2)), 'user_id': fields.many2one('res.users', 'Responsible'), } _defaults = { @@ -1186,7 +1191,7 @@ class project_task_history_cumulative(osv.osv): id as history_id, date+generate_series(0, CAST((coalesce(end_date,DATE 'tomorrow')::date - date)AS integer)-1) as date, task_id, type_id, user_id, kanban_state, state, - remaining_hours + remaining_hours, planned_hours FROM project_task_history ) as history diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 0da6b2e247e..9e58946bf73 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -378,6 +378,7 @@ type="object" class="oe_kanban_button"> +
diff --git a/addons/project/report/project_cumulative.xml b/addons/project/report/project_cumulative.xml index aff90aea94e..89667992f0a 100644 --- a/addons/project/report/project_cumulative.xml +++ b/addons/project/report/project_cumulative.xml @@ -25,6 +25,18 @@ graph + + + + + + + + project.task.history.burndown.graph + project.task.history.burndown + graph + + @@ -32,12 +44,13 @@ + project.task.history.cumulative.search project.task.history.cumulative search - + @@ -69,13 +82,28 @@ project.task.history.cumulative form graph,tree + - {"search_default_open":1, "search_default_this_month": 1} + {"search_default_open":1, "search_default_this_month": 1, "search_default_project_id": project_id} + + Burndown Chart + project.task.history.cumulative + form + graph,tree + + + {"search_default_open":1, "search_default_this_month": 1, "search_default_project_id": project_id} + + + +