2009-10-13 05:58:37 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2006-12-07 13:41:40 +00:00
|
|
|
##############################################################################
|
2010-02-02 09:33:00 +00:00
|
|
|
#
|
2009-10-14 11:15:34 +00:00
|
|
|
# OpenERP, Open Source Management Solution
|
2010-01-12 09:18:39 +00:00
|
|
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
2008-11-03 19:18:56 +00:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2009-10-14 11:15:34 +00:00
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
2008-11-03 19:18:56 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2009-10-14 11:15:34 +00:00
|
|
|
# GNU Affero General Public License for more details.
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
2009-10-14 11:15:34 +00:00
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
2010-02-02 09:33:00 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
2013-06-26 13:25:19 +00:00
|
|
|
from openerp.osv import fields, osv
|
2012-12-06 14:56:32 +00:00
|
|
|
from openerp import tools
|
2006-12-07 13:41:40 +00:00
|
|
|
|
2013-06-26 14:22:42 +00:00
|
|
|
|
2006-12-07 13:41:40 +00:00
|
|
|
class report_project_task_user(osv.osv):
|
|
|
|
_name = "report.project.task.user"
|
|
|
|
_description = "Tasks by user and project"
|
|
|
|
_auto = False
|
|
|
|
_columns = {
|
2014-05-21 09:52:05 +00:00
|
|
|
'name': fields.char('Task Summary', readonly=True),
|
2010-07-02 14:37:06 +00:00
|
|
|
'user_id': fields.many2one('res.users', 'Assigned To', readonly=True),
|
2014-07-01 08:32:01 +00:00
|
|
|
'reviewer_id': fields.many2one('res.users', 'Reviewer', readonly=True),
|
2014-08-21 10:53:47 +00:00
|
|
|
'date_start': fields.datetime('Assignation Date', readonly=True),
|
2010-05-24 10:22:39 +00:00
|
|
|
'no_of_days': fields.integer('# of Days', size=128, readonly=True),
|
2014-08-21 10:53:47 +00:00
|
|
|
'date_end': fields.datetime('Ending Date', readonly=True),
|
2010-07-02 14:37:06 +00:00
|
|
|
'date_deadline': fields.date('Deadline', readonly=True),
|
2014-08-21 10:53:47 +00:00
|
|
|
'date_last_stage_update': fields.datetime('Last Stage Update', readonly=True),
|
2010-07-02 14:37:06 +00:00
|
|
|
'project_id': fields.many2one('project.project', 'Project', readonly=True),
|
2006-12-07 13:41:40 +00:00
|
|
|
'hours_planned': fields.float('Planned Hours', readonly=True),
|
|
|
|
'hours_effective': fields.float('Effective Hours', readonly=True),
|
|
|
|
'hours_delay': fields.float('Avg. Plan.-Eff.', readonly=True),
|
2010-05-24 10:22:39 +00:00
|
|
|
'remaining_hours': fields.float('Remaining Hours', readonly=True),
|
2010-08-25 14:08:25 +00:00
|
|
|
'progress': fields.float('Progress', readonly=True, group_operator='avg'),
|
2010-05-24 10:22:39 +00:00
|
|
|
'total_hours': fields.float('Total Hours', readonly=True),
|
|
|
|
'closing_days': fields.float('Days to Close', digits=(16,2), readonly=True, group_operator="avg",
|
2010-04-19 12:43:37 +00:00
|
|
|
help="Number of Days to close the task"),
|
2013-06-26 13:25:19 +00:00
|
|
|
'opening_days': fields.float('Days to Assign', digits=(16,2), readonly=True, group_operator="avg",
|
2010-05-24 10:22:39 +00:00
|
|
|
help="Number of Days to Open the task"),
|
2010-06-04 17:54:17 +00:00
|
|
|
'delay_endings_days': fields.float('Overpassed Deadline', digits=(16,2), readonly=True),
|
2014-02-14 11:49:37 +00:00
|
|
|
'priority': fields.selection([('0','Low'), ('1','Normal'), ('2','High')],
|
2014-05-21 09:52:05 +00:00
|
|
|
string='Priority', size=1, readonly=True),
|
2014-08-21 10:53:47 +00:00
|
|
|
'state': fields.selection([('normal', 'In Progress'),('blocked', 'Blocked'),('done', 'Ready for next stage')],'Status', readonly=True),
|
2012-07-09 11:41:52 +00:00
|
|
|
'company_id': fields.many2one('res.company', 'Company', readonly=True),
|
2012-08-09 10:50:09 +00:00
|
|
|
'partner_id': fields.many2one('res.partner', 'Contact', readonly=True),
|
2013-06-26 13:25:19 +00:00
|
|
|
'stage_id': fields.many2one('project.task.type', 'Stage'),
|
2014-08-21 10:53:47 +00:00
|
|
|
'nbr_tasks': fields.integer('# of Tasks', readonly=True, oldname='nbr'),
|
2006-12-07 13:41:40 +00:00
|
|
|
}
|
|
|
|
_order = 'name desc, project_id'
|
2010-07-02 14:37:06 +00:00
|
|
|
|
2006-12-07 13:41:40 +00:00
|
|
|
def init(self, cr):
|
2009-11-24 13:58:06 +00:00
|
|
|
tools.sql.drop_view_if_exists(cr, 'report_project_task_user')
|
2006-12-07 13:41:40 +00:00
|
|
|
cr.execute("""
|
2010-07-02 14:37:06 +00:00
|
|
|
CREATE view report_project_task_user as
|
|
|
|
SELECT
|
2014-08-21 10:53:47 +00:00
|
|
|
(select 1 ) AS nbr_tasks,
|
2010-06-04 17:54:17 +00:00
|
|
|
t.id as id,
|
2014-08-21 10:53:47 +00:00
|
|
|
t.date_start as date_start,
|
|
|
|
t.date_end as date_end,
|
|
|
|
t.date_last_stage_update as date_last_stage_update,
|
2014-07-28 08:34:30 +00:00
|
|
|
t.date_deadline as date_deadline,
|
2013-10-23 11:37:16 +00:00
|
|
|
abs((extract('epoch' from (t.write_date-t.date_start)))/(3600*24)) as no_of_days,
|
2006-12-07 13:41:40 +00:00
|
|
|
t.user_id,
|
2014-07-01 08:32:01 +00:00
|
|
|
t.reviewer_id,
|
2010-06-04 17:54:17 +00:00
|
|
|
progress as progress,
|
2006-12-07 13:41:40 +00:00
|
|
|
t.project_id,
|
2010-06-04 17:54:17 +00:00
|
|
|
t.effective_hours as hours_effective,
|
2010-04-09 08:55:14 +00:00
|
|
|
t.priority,
|
2010-05-05 10:34:09 +00:00
|
|
|
t.name as name,
|
2010-04-09 08:55:14 +00:00
|
|
|
t.company_id,
|
|
|
|
t.partner_id,
|
2013-06-26 13:25:19 +00:00
|
|
|
t.stage_id as stage_id,
|
2014-08-21 10:53:47 +00:00
|
|
|
t.kanban_state as state,
|
2010-06-04 17:54:17 +00:00
|
|
|
remaining_hours as remaining_hours,
|
|
|
|
total_hours as total_hours,
|
|
|
|
t.delay_hours as hours_delay,
|
|
|
|
planned_hours as hours_planned,
|
2013-10-23 11:37:16 +00:00
|
|
|
(extract('epoch' from (t.write_date-t.create_date)))/(3600*24) as closing_days,
|
2010-06-04 17:54:17 +00:00
|
|
|
(extract('epoch' from (t.date_start-t.create_date)))/(3600*24) as opening_days,
|
2013-10-23 11:37:16 +00:00
|
|
|
abs((extract('epoch' from (t.date_deadline-t.write_date)))/(3600*24)) as delay_endings_days
|
2010-07-02 14:37:06 +00:00
|
|
|
FROM project_task t
|
2011-11-29 10:35:37 +00:00
|
|
|
WHERE t.active = 'true'
|
2010-07-02 14:37:06 +00:00
|
|
|
GROUP BY
|
2010-06-04 17:54:17 +00:00
|
|
|
t.id,
|
|
|
|
remaining_hours,
|
|
|
|
t.effective_hours,
|
|
|
|
progress,
|
|
|
|
total_hours,
|
|
|
|
planned_hours,
|
|
|
|
hours_delay,
|
|
|
|
create_date,
|
2013-10-23 11:55:25 +00:00
|
|
|
write_date,
|
2010-06-04 17:54:17 +00:00
|
|
|
date_start,
|
|
|
|
date_end,
|
|
|
|
date_deadline,
|
2013-06-26 13:25:19 +00:00
|
|
|
date_last_stage_update,
|
2010-04-09 08:55:14 +00:00
|
|
|
t.user_id,
|
2014-07-01 08:32:01 +00:00
|
|
|
t.reviewer_id,
|
2010-06-04 17:54:17 +00:00
|
|
|
t.project_id,
|
|
|
|
t.priority,
|
|
|
|
name,
|
2010-04-09 08:55:14 +00:00
|
|
|
t.company_id,
|
|
|
|
t.partner_id,
|
2013-06-26 13:25:19 +00:00
|
|
|
stage_id
|
2006-12-07 13:41:40 +00:00
|
|
|
""")
|