1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as
9 # published by the Free Software Foundation, either version 3 of the
10 # License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ##############################################################################
22 from openerp import tools
23 from openerp.osv import fields, osv
26 class hr_evaluation_report(osv.Model):
27 _name = "hr.evaluation.report"
28 _description = "Evaluations Statistics"
31 'create_date': fields.datetime('Create Date', readonly=True),
32 'delay_date': fields.float('Delay to Start', digits=(16, 2), readonly=True),
33 'overpass_delay': fields.float('Overpassed Deadline', digits=(16, 2), readonly=True),
34 'deadline': fields.date("Deadline", readonly=True),
35 'request_id': fields.many2one('survey.user_input', 'Request ID', readonly=True),
36 'closed': fields.date("Close Date", readonly=True), # TDE FIXME master: rename into date_close
37 'plan_id': fields.many2one('hr_evaluation.plan', 'Plan', readonly=True),
38 'employee_id': fields.many2one('hr.employee', "Employee", readonly=True),
39 'rating': fields.selection([
40 ('0', 'Significantly bellow expectations'),
41 ('1', 'Did not meet expectations'),
42 ('2', 'Meet expectations'),
43 ('3', 'Exceeds expectations'),
44 ('4', 'Significantly exceeds expectations'),
45 ], "Overall Rating", readonly=True),
46 'nbr': fields.integer('# of Requests', readonly=True), # TDE FIXME master: rename into nbr_requests
47 'state': fields.selection([
49 ('wait', 'Plan In Progress'),
50 ('progress', 'Final Validation'),
52 ('cancel', 'Cancelled'),
53 ], 'Status', readonly=True),
55 _order = 'create_date desc'
58 'hr.evaluation.interview': ['evaluation_id', 'id', 'request_id'],
59 'hr_evaluation.evaluation': [
60 'create_date', 'date', 'date_close', 'employee_id', 'plan_id',
66 tools.drop_view_if_exists(cr, 'hr_evaluation_report')
68 create or replace view hr_evaluation_report as (
71 s.create_date as create_date,
77 s.date_close as closed,
80 avg(extract('epoch' from age(s.create_date,CURRENT_DATE)))/(3600*24) as delay_date,
81 avg(extract('epoch' from age(s.date,CURRENT_DATE)))/(3600*24) as overpass_delay
83 hr_evaluation_interview l
85 hr_evaluation_evaluation s on (s.id=l.evaluation_id)
99 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: