New trunk
[odoo/odoo.git] / addons / hr_evaluation / hr_evaluation.py
1 ##############################################################################
2 #
3 # Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
4 #
5 # $Id: hr.py 3428 2006-06-22 23:17:17Z pinky $
6 #
7 # WARNING: This program as such is intended to be used by professional
8 # programmers who take the whole responsability of assessing all potential
9 # consequences resulting from its eventual inadequacies and bugs
10 # End users who are looking for a ready-to-use solution with commercial
11 # garantees and support are strongly adviced to contract a Free Software
12 # Service Company
13 #
14 # This program is Free Software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License
16 # as published by the Free Software Foundation; either version 2
17 # of the License, or (at your option) any later version.
18 #
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 # GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write to the Free Software
26 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
27 #
28 ##############################################################################
29
30 import time
31 from osv import fields, osv
32
33 class hr_evaluation(osv.osv):
34         _name = "hr_evaluation.evaluation"
35         _description = "Employee Evaluation"
36         _columns = {
37                 'name': fields.char("Summary", size=64, required=True),
38                 'date': fields.date("Date", required=True),
39                 'employee_id': fields.many2one("hr.employee", "Employee", required=True),
40                 'user_id': fields.many2one("res.users", "Evaluation User", required=True),
41                 'info_good': fields.text('Good Points'),
42                 'info_bad': fields.text('Bad Points'),
43                 'info_improve': fields.text('To Improve'),
44                 'score': fields.float("Score"),
45                 'info_employee': fields.text('Employee Response'),
46                 'quote_ids': fields.one2many('hr_evaluation.quote', 'evaluation_id', 'Quotes'),
47                 'state': fields.selection([('draft','Draft'),('done','Done')], 'State')
48         }
49         _defaults = {
50                 'date' : lambda *a: time.strftime('%Y-%m-%d'),
51                 'state' : lambda *a: 'draft',
52                 'user_id' : lambda self,cr,uid,context={}: uid
53         }
54 hr_evaluation()
55
56 class hr_evaluation_type(osv.osv):
57         _name = "hr_evaluation.type"
58         _description = "Employee Evaluation Type"
59         _columns = {
60                 'name': fields.char("Evaluation Criterion", size=64, required=True),
61                 'category_ids': fields.many2many('hr.employee.category', 'hr_evaluation_category_rel', 'type_id', 'category_id', 'Appliable Role'),
62                 'active': fields.boolean("Active"),
63                 'value_ids': fields.one2many('hr_evaluation.type.value', 'type_id', 'Values'),
64                 'info': fields.text('Information'),
65                 'score': fields.float('Score'),
66         }
67         _defaults = {
68                 'active' : lambda *a: True,
69         }
70 hr_evaluation_type()
71
72 class hr_evaluation_type_value(osv.osv):
73         _name = "hr_evaluation.type.value"
74         _description = "Evaluation Type Value"
75         _columns = {
76                 'name': fields.char("Value", size=64, required=True),
77                 'score': fields.float("Score"),
78                 'type_id': fields.many2one('hr_evaluation.type', 'Evaluation Type', required=True),
79         }
80 hr_evaluation_type_value()
81
82 class hr_evaluation_quote(osv.osv):
83         _name = "hr_evaluation.quote"
84         _description = "Employee Evaluation Quote"
85         _columns = {
86                 'name': fields.char("Quote", size=64),
87                 'type_id': fields.many2one('hr_evaluation.type', 'Type'),
88                 'score': fields.float("Score"),
89                 'value_id': fields.many2one('hr_evaluation.type.value', 'Value', domain="[('type_id','=',type_id)])"),
90                 'evaluation_id': fields.many2one('hr_evaluation.evaluation', 'Evaluation', required=True)
91         }
92 hr_evaluation_quote()