1 # -*- encoding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2009 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 ##############################################################################
23 from osv import fields, osv
25 class hr_evaluation_plan(osv.osv):
26 _name = "hr_evaluation.plan"
27 _description = "Evaluation Plan"
29 'name': fields.char("Evaluation Plan", size=64, required=True),
30 'company_id': fields.many2one('res.company', 'Company', required=True),
31 'phase_ids' : fields.one2many('hr_evaluation.plan.phase', 'plan_id', 'Evaluation Phases'),
32 'month_first': fields.integer('First Evaluation After'),
33 'month_next': fields.integer('Next Evaluation After'),
34 'active': fields.boolean('Active')
37 'active' : lambda *a: True,
41 class hr_evaluation_plan_phase(osv.osv):
42 _name = "hr_evaluation.plan.phase"
43 _description = "Evaluation Plan Phase"
46 'name': fields.char("Phase", size=64, required=True),
47 'sequence': fields.integer("Sequence"),
48 'company_id': fields.related('plan_id','company_id',type='many2one',relation='res.company',string='Company',store=True),
49 'plan_id': fields.many2one('hr_evaluation.plan','Evaluation Plan', required=True, ondelete='cascade'),
50 'action': fields.selection([
51 ('top-down','Top-Down Appraisal Requests'),
52 ('bottom-up','Bottom-Up Appraisal Requests'),
53 ('self','Self Appraisal Requests'),
54 ('final','Final Interview')], 'Action', required=True),
55 'survey_id': fields.many2one('survey','Appraisal Form',required=True),
56 'send_answer_manager': fields.boolean('All Answers',
57 help="Send all answers to the manager"),
58 'send_answer_employee': fields.boolean('All Answers',
59 help="Send all answers to the employee"),
60 'send_anonymous_manager': fields.boolean('Anonymous Summary',
61 help="Send an anonymous summary to the manager"),
62 'send_anonymous_employee': fields.boolean('Anonymous Summary',
63 help="Send an anonymous summary to the employee"),
64 'wait': fields.boolean('Wait Previous Phases',
65 help="Check this box if you want to wait that all preceeding phases " +
66 "are finished before launching this phase.")
70 'sequence' : lambda *a: 1,
72 hr_evaluation_plan_phase()
74 class hr_employee(osv.osv):
75 _inherit="hr.employee"
77 'evaluation_plan_id': fields.many2one('hr_evaluation.plan', 'Evaluation Plan'),
78 'evaluation_date': fields.date('Next Evaluation', help="Date of the next evaluation"),
80 def onchange_evaluation_plan_id(self, *args):
81 # return the right evaluation date
85 class hr_evaluation(osv.osv):
86 _name = "hr_evaluation.evaluation"
87 _description = "Employee Evaluation"
88 _rec_name = 'employee_id'
90 'date': fields.date("Evaluation Deadline", required=True),
91 'employee_id': fields.many2one('hr.employee', "Employee", required=True),
92 'manager_id': fields.many2one('res.users', "Manager", required=True),
93 'note_summary': fields.text('Evaluation Summary'),
94 'note_action': fields.text('Action Plan',
95 help="If the evaluation does not meet the expectations, you can propose"+
97 'rating': fields.selection([
98 ('0','Significantly bellow expectations'),
99 ('1','Did not meet expectations'),
100 ('2','Meet expectations'),
101 ('3','Exceeds expectations'),
102 ('4','Significantly exceeds expectations'),
103 ], "Overall Rating", help="This is the overall rating on that summarize the evaluation"),
104 'survey_request_ids': fields.many2many('survey.request',
105 'hr_evaluation_evaluation_requests',
109 'plan_id': fields.many2one('hr_evaluation.plan', 'Plan'),
110 'phase_id': fields.many2one('hr_evaluation.plan.phase', 'Phase'),
111 'state': fields.selection([
113 ('wait','Plan In Progress'),
114 ('progress','Final Validation'),
116 ('cancel','Cancelled'),
117 ], 'State', required=True,readonly=True)
120 'date' : lambda *a: time.strftime('%Y-%m-%d'),
121 'state' : lambda *a: 'draft',
124 def button_plan_in_progress(self,cr, uid, ids, context):
125 self.write(cr,uid,ids,{'state':'wait'})
128 def button_final_validation(self,cr, uid, ids, context):
129 self.write(cr,uid,ids,{'state':'progress'})
132 def button_done(self,cr, uid, ids, context):
133 self.write(cr,uid,ids,{'state':'done'})
136 def button_cancel(self,cr, uid, ids, context):
137 self.write(cr,uid,ids,{'state':'cancel'})