2010-01-20 14:28:28 +00:00
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# 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.
#
# 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
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
2010-10-15 14:01:53 +00:00
from datetime import datetime
from dateutil . relativedelta import relativedelta
from dateutil import parser
2010-03-11 14:08:44 +00:00
from osv import fields , osv
2010-03-05 12:21:31 +00:00
from tools . translate import _
2010-01-20 14:28:28 +00:00
class hr_evaluation_plan ( osv . osv ) :
_name = " hr_evaluation.plan "
2011-11-08 06:20:07 +00:00
_description = " Appraisal Plan "
2010-01-20 14:28:28 +00:00
_columns = {
2011-11-08 06:20:07 +00:00
' name ' : fields . char ( " Appraisal Plan " , size = 64 , required = True ) ,
2010-01-20 14:28:28 +00:00
' company_id ' : fields . many2one ( ' res.company ' , ' Company ' , required = True ) ,
2011-11-08 06:20:07 +00:00
' phase_ids ' : fields . one2many ( ' hr_evaluation.plan.phase ' , ' plan_id ' , ' Appraisal Phases ' ) ,
' month_first ' : fields . integer ( ' First Appraisal in (months) ' , help = " This number of months will be used to schedule the first evaluation date of the employee when selecting an evaluation plan. " ) ,
' month_next ' : fields . integer ( ' Periodicity of Appraisal (months) ' , help = " The number of month that depicts the delay between each evaluation of this plan (after the first one). " ) ,
2010-01-20 14:28:28 +00:00
' active ' : fields . boolean ( ' Active ' )
2010-08-20 11:30:54 +00:00
}
2010-01-20 14:28:28 +00:00
_defaults = {
2010-07-03 10:21:52 +00:00
' active ' : True ,
2011-10-01 23:17:11 +00:00
' month_first ' : 6 ,
' month_next ' : 12 ,
2010-07-01 13:33:02 +00:00
' company_id ' : lambda s , cr , uid , c : s . pool . get ( ' res.company ' ) . _company_default_get ( cr , uid , ' account.account ' , context = c ) ,
2010-08-20 11:30:54 +00:00
}
2010-01-20 14:28:28 +00:00
hr_evaluation_plan ( )
class hr_evaluation_plan_phase ( osv . osv ) :
_name = " hr_evaluation.plan.phase "
2011-11-08 06:20:07 +00:00
_description = " Appraisal Plan Phase "
2010-01-20 14:28:28 +00:00
_order = " sequence "
_columns = {
' name ' : fields . char ( " Phase " , size = 64 , required = True ) ,
' sequence ' : fields . integer ( " Sequence " ) ,
2011-01-06 11:32:21 +00:00
' company_id ' : fields . related ( ' plan_id ' , ' company_id ' , type = ' many2one ' , relation = ' res.company ' , string = ' Company ' , store = True , readonly = True ) ,
2011-11-08 06:20:07 +00:00
' plan_id ' : fields . many2one ( ' hr_evaluation.plan ' , ' Appraisal Plan ' , ondelete = ' cascade ' ) ,
2010-01-20 14:28:28 +00:00
' action ' : fields . selection ( [
( ' top-down ' , ' Top-Down Appraisal Requests ' ) ,
( ' bottom-up ' , ' Bottom-Up Appraisal Requests ' ) ,
( ' self ' , ' Self Appraisal Requests ' ) ,
( ' final ' , ' Final Interview ' ) ] , ' Action ' , required = True ) ,
2010-01-21 06:00:41 +00:00
' survey_id ' : fields . many2one ( ' survey ' , ' Appraisal Form ' , required = True ) ,
2010-01-20 14:28:28 +00:00
' send_answer_manager ' : fields . boolean ( ' All Answers ' ,
help = " Send all answers to the manager " ) ,
' send_answer_employee ' : fields . boolean ( ' All Answers ' ,
help = " Send all answers to the employee " ) ,
' send_anonymous_manager ' : fields . boolean ( ' Anonymous Summary ' ,
help = " Send an anonymous summary to the manager " ) ,
' send_anonymous_employee ' : fields . boolean ( ' Anonymous Summary ' ,
help = " Send an anonymous summary to the employee " ) ,
' wait ' : fields . boolean ( ' Wait Previous Phases ' ,
2010-09-06 11:39:53 +00:00
help = " Check this box if you want to wait that all preceding phases " +
2010-03-16 13:33:09 +00:00
" are finished before launching this phase. " ) ,
2010-06-16 11:51:39 +00:00
' mail_feature ' : fields . boolean ( ' Send mail for this phase ' , help = " Check this box if you want to send mail to employees " +
2010-09-06 11:39:53 +00:00
" coming under this phase " ) ,
2010-03-16 13:33:09 +00:00
' mail_body ' : fields . text ( ' Email ' ) ,
' email_subject ' : fields . text ( ' char ' )
2010-01-20 14:28:28 +00:00
}
_defaults = {
2010-10-27 12:49:59 +00:00
' sequence ' : 1 ,
2010-07-03 10:21:52 +00:00
' email_subject ' : _ ( ''' Regarding ''' ) ,
2010-10-27 12:49:59 +00:00
' mail_body ' : lambda * a : _ ( '''
Date : % ( date ) s
2010-03-16 13:33:09 +00:00
Dear % ( employee_name ) s ,
I am doing an evaluation regarding % ( eval_name ) s .
Kindly submit your response .
Thanks ,
- -
% ( user_signature ) s
2010-03-22 13:59:23 +00:00
''' ),
2010-01-20 14:28:28 +00:00
}
hr_evaluation_plan_phase ( )
class hr_employee ( osv . osv ) :
2010-03-11 14:08:44 +00:00
_name = " hr.employee "
2010-01-20 14:28:28 +00:00
_inherit = " hr.employee "
_columns = {
2011-11-08 06:20:07 +00:00
' evaluation_plan_id ' : fields . many2one ( ' hr_evaluation.plan ' , ' Appraisal Plan ' ) ,
' evaluation_date ' : fields . date ( ' Next Appraisal Date ' , help = " The date of the next appraisal is computed by the appraisal plan ' s dates (first appraisal + periodicity). " ) ,
2010-01-20 14:28:28 +00:00
}
2010-03-05 12:21:31 +00:00
2010-03-11 14:08:44 +00:00
def run_employee_evaluation ( self , cr , uid , automatic = False , use_new_cursor = False , context = None ) :
2010-07-27 07:11:45 +00:00
obj_evaluation = self . pool . get ( ' hr_evaluation.evaluation ' )
2010-06-16 11:51:39 +00:00
for id in self . browse ( cr , uid , self . search ( cr , uid , [ ] , context = context ) , context = context ) :
2010-03-11 14:08:44 +00:00
if id . evaluation_plan_id and id . evaluation_date :
2010-10-15 14:01:53 +00:00
if ( parser . parse ( id . evaluation_date ) + relativedelta ( months = int ( id . evaluation_plan_id . month_next ) ) ) . strftime ( ' % Y- % m- %d ' ) < = time . strftime ( " % Y- % m- %d " ) :
2010-10-27 12:49:59 +00:00
self . write ( cr , uid , id . id , { ' evaluation_date ' : ( parser . parse ( id . evaluation_date ) + relativedelta ( months = + int ( id . evaluation_plan_id . month_next ) ) ) . strftime ( ' % Y- % m- %d ' ) } , context = context )
obj_evaluation . create ( cr , uid , { ' employee_id ' : id . id , ' plan_id ' : id . evaluation_plan_id } , context = context )
2010-03-11 14:08:44 +00:00
return True
2010-07-03 10:21:52 +00:00
def onchange_evaluation_plan_id ( self , cr , uid , ids , evaluation_plan_id , evaluation_date , context = None ) :
2010-03-03 13:42:00 +00:00
if evaluation_plan_id :
2010-10-08 13:22:47 +00:00
evaluation_plan_obj = self . pool . get ( ' hr_evaluation.plan ' )
obj_evaluation = self . pool . get ( ' hr_evaluation.evaluation ' )
2010-03-11 14:08:44 +00:00
flag = False
2010-06-16 11:51:39 +00:00
evaluation_plan = evaluation_plan_obj . browse ( cr , uid , [ evaluation_plan_id ] , context = context ) [ 0 ]
2010-03-11 14:08:44 +00:00
if not evaluation_date :
2010-10-20 13:29:48 +00:00
evaluation_date = ( parser . parse ( datetime . now ( ) . strftime ( ' % Y- % m- %d ' ) ) + relativedelta ( months = + evaluation_plan . month_first ) ) . strftime ( ' % Y- % m- %d ' )
2010-03-11 14:08:44 +00:00
flag = True
else :
2010-10-15 14:01:53 +00:00
if ( parser . parse ( evaluation_date ) + relativedelta ( months = int ( evaluation_plan . month_next ) ) ) . strftime ( ' % Y- % m- %d ' ) < = time . strftime ( " % Y- % m- %d " ) :
evaluation_date = ( parser . parse ( evaluation_date ) + relativedelta ( months = + evaluation_plan . month_next ) ) . strftime ( ' % Y- % m- %d ' )
2010-03-11 14:08:44 +00:00
flag = True
if ids and flag :
2010-08-20 11:30:54 +00:00
obj_evaluation . create ( cr , uid , { ' employee_id ' : ids [ 0 ] , ' plan_id ' : evaluation_plan_id } , context = context )
2010-07-03 10:21:52 +00:00
return { ' value ' : { ' evaluation_date ' : evaluation_date } }
2010-03-11 14:08:44 +00:00
2010-07-03 10:21:52 +00:00
def create ( self , cr , uid , vals , context = None ) :
2010-03-11 14:08:44 +00:00
id = super ( hr_employee , self ) . create ( cr , uid , vals , context = context )
if vals . get ( ' evaluation_plan_id ' , False ) :
2010-10-27 12:49:59 +00:00
self . pool . get ( ' hr_evaluation.evaluation ' ) . create ( cr , uid , { ' employee_id ' : id , ' plan_id ' : vals [ ' evaluation_plan_id ' ] } , context = context )
2010-03-11 14:08:44 +00:00
return id
2010-01-20 14:28:28 +00:00
hr_employee ( )
class hr_evaluation ( osv . osv ) :
_name = " hr_evaluation.evaluation "
2011-11-08 06:20:07 +00:00
_description = " Employee Appraisal "
2010-01-20 14:28:28 +00:00
_rec_name = ' employee_id '
_columns = {
2011-11-08 06:20:07 +00:00
' date ' : fields . date ( " Appraisal Deadline " , required = True , select = True ) ,
2010-01-20 14:28:28 +00:00
' employee_id ' : fields . many2one ( ' hr.employee ' , " Employee " , required = True ) ,
2011-11-08 06:20:07 +00:00
' note_summary ' : fields . text ( ' Appraisal Summary ' ) ,
2010-01-20 14:28:28 +00:00
' note_action ' : fields . text ( ' Action Plan ' ,
help = " If the evaluation does not meet the expectations, you can propose " +
" an action plan " ) ,
' rating ' : fields . selection ( [
( ' 0 ' , ' Significantly bellow expectations ' ) ,
( ' 1 ' , ' Did not meet expectations ' ) ,
( ' 2 ' , ' Meet expectations ' ) ,
( ' 3 ' , ' Exceeds expectations ' ) ,
( ' 4 ' , ' Significantly exceeds expectations ' ) ,
2012-07-13 10:17:51 +00:00
] , " Appreciation " , help = " This is the appreciation on which the evaluation is summarized. " ) ,
2010-03-05 12:21:31 +00:00
' survey_request_ids ' : fields . one2many ( ' hr.evaluation.interview ' , ' evaluation_id ' , ' Appraisal Forms ' ) ,
2010-03-04 07:11:37 +00:00
' plan_id ' : fields . many2one ( ' hr_evaluation.plan ' , ' Plan ' , required = True ) ,
2010-01-20 14:28:28 +00:00
' state ' : fields . selection ( [
2011-09-14 13:11:11 +00:00
( ' draft ' , ' New ' ) ,
2012-05-01 12:34:46 +00:00
( ' cancel ' , ' Cancelled ' ) ,
2010-01-20 14:28:28 +00:00
( ' wait ' , ' Plan In Progress ' ) ,
2010-09-22 07:05:07 +00:00
( ' progress ' , ' Waiting Appreciation ' ) ,
2010-01-20 14:28:28 +00:00
( ' done ' , ' Done ' ) ,
2012-05-04 11:57:48 +00:00
] , ' Status ' , required = True , readonly = True ) ,
2011-01-17 11:20:56 +00:00
' date_close ' : fields . date ( ' Ending Date ' , select = True ) ,
2010-01-20 14:28:28 +00:00
}
_defaults = {
2010-10-27 12:49:59 +00:00
' date ' : lambda * a : ( parser . parse ( datetime . now ( ) . strftime ( ' % Y- % m- %d ' ) ) + relativedelta ( months = + 1 ) ) . strftime ( ' % Y- % m- %d ' ) ,
' state ' : lambda * a : ' draft ' ,
2010-01-20 14:28:28 +00:00
}
2010-07-27 07:11:45 +00:00
def name_get ( self , cr , uid , ids , context = None ) :
2010-10-27 12:49:59 +00:00
if not ids :
2010-07-01 13:33:02 +00:00
return [ ]
2010-07-27 07:11:45 +00:00
reads = self . browse ( cr , uid , ids , context = context )
2010-07-01 13:33:02 +00:00
res = [ ]
for record in reads :
name = record . plan_id . name
res . append ( ( record [ ' id ' ] , name ) )
return res
2010-07-01 13:43:56 +00:00
2010-07-03 10:21:52 +00:00
def onchange_employee_id ( self , cr , uid , ids , employee_id , context = None ) :
2010-10-08 13:22:47 +00:00
evaluation_plan_id = False
2010-03-05 12:21:31 +00:00
if employee_id :
2010-10-08 13:22:47 +00:00
employee_obj = self . pool . get ( ' hr.employee ' )
2010-06-16 11:51:39 +00:00
for employee in employee_obj . browse ( cr , uid , [ employee_id ] , context = context ) :
2010-03-05 12:21:31 +00:00
if employee and employee . evaluation_plan_id and employee . evaluation_plan_id . id :
evaluation_plan_id = employee . evaluation_plan_id . id
return { ' value ' : { ' plan_id ' : evaluation_plan_id } }
2010-07-03 10:21:52 +00:00
def button_plan_in_progress ( self , cr , uid , ids , context = None ) :
2011-08-22 17:16:59 +00:00
mail_message = self . pool . get ( ' mail.message ' )
2010-07-27 07:11:45 +00:00
hr_eval_inter_obj = self . pool . get ( ' hr.evaluation.interview ' )
if context is None :
context = { }
for evaluation in self . browse ( cr , uid , ids , context = context ) :
2010-04-07 09:54:57 +00:00
wait = False
for phase in evaluation . plan_id . phase_ids :
2010-10-25 08:48:51 +00:00
children = [ ]
2010-04-07 09:54:57 +00:00
if phase . action == " bottom-up " :
2010-10-25 08:48:51 +00:00
children = evaluation . employee_id . child_ids
2010-04-07 09:54:57 +00:00
elif phase . action in ( " top-down " , " final " ) :
if evaluation . employee_id . parent_id :
2010-10-25 08:48:51 +00:00
children = [ evaluation . employee_id . parent_id ]
2010-04-07 09:54:57 +00:00
elif phase . action == " self " :
2010-10-25 08:48:51 +00:00
children = [ evaluation . employee_id ]
for child in children :
2010-09-15 13:50:27 +00:00
# if not child.user_id:
# continue
2010-04-07 09:54:57 +00:00
int_id = hr_eval_inter_obj . create ( cr , uid , {
' evaluation_id ' : evaluation . id ,
' survey_id ' : phase . survey_id . id ,
2010-10-19 06:31:32 +00:00
' date_deadline ' : ( parser . parse ( datetime . now ( ) . strftime ( ' % Y- % m- %d ' ) ) + relativedelta ( months = + 1 ) ) . strftime ( ' % Y- % m- %d ' ) ,
2010-04-07 09:54:57 +00:00
' user_id ' : child . user_id . id ,
' user_to_review_id ' : evaluation . employee_id . id
} , context = context )
if phase . wait :
wait = True
if not wait :
hr_eval_inter_obj . survey_req_waiting_answer ( cr , uid , [ int_id ] , context = context )
if ( not wait ) and phase . mail_feature :
2010-10-17 22:27:08 +00:00
body = phase . mail_body % { ' employee_name ' : child . name , ' user_signature ' : child . user_id . signature ,
2010-07-03 10:21:52 +00:00
' eval_name ' : phase . survey_id . title , ' date ' : time . strftime ( ' % Y- % m- %d ' ) , ' time ' : time }
2010-04-07 09:54:57 +00:00
sub = phase . email_subject
dest = [ child . work_email ]
if dest :
2011-08-22 17:16:59 +00:00
mail_message . schedule_with_attach ( cr , uid , evaluation . employee_id . work_email , dest , sub , body , context = context )
2010-04-07 09:54:57 +00:00
2010-06-16 11:51:39 +00:00
self . write ( cr , uid , ids , { ' state ' : ' wait ' } , context = context )
2010-01-20 14:28:28 +00:00
return True
2010-07-03 10:21:52 +00:00
def button_final_validation ( self , cr , uid , ids , context = None ) :
2010-03-05 12:21:31 +00:00
request_obj = self . pool . get ( ' hr.evaluation.interview ' )
2010-07-27 07:11:45 +00:00
self . write ( cr , uid , ids , { ' state ' : ' progress ' } , context = context )
2010-10-27 12:49:59 +00:00
for id in self . browse ( cr , uid , ids , context = context ) :
2011-12-05 13:21:02 +00:00
if len ( id . survey_request_ids ) != len ( request_obj . search ( cr , uid , [ ( ' evaluation_id ' , ' = ' , id . id ) , ( ' state ' , ' in ' , [ ' done ' , ' cancel ' ] ) ] , context = context ) ) :
2012-08-07 11:34:14 +00:00
raise osv . except_osv ( _ ( ' Warning! ' ) , _ ( " You cannot change state, because some appraisal(s) are in waiting answer or draft state. " ) )
2010-01-20 14:28:28 +00:00
return True
2010-07-03 10:21:52 +00:00
def button_done ( self , cr , uid , ids , context = None ) :
2010-07-27 07:11:45 +00:00
self . write ( cr , uid , ids , { ' state ' : ' done ' , ' date_close ' : time . strftime ( ' % Y- % m- %d ' ) } , context = context )
2010-01-20 14:28:28 +00:00
return True
2010-07-03 10:21:52 +00:00
def button_cancel ( self , cr , uid , ids , context = None ) :
2011-11-29 09:52:34 +00:00
interview_obj = self . pool . get ( ' hr.evaluation.interview ' )
evaluation = self . browse ( cr , uid , ids [ 0 ] , context )
interview_obj . survey_req_cancel ( cr , uid , [ r . id for r in evaluation . survey_request_ids ] )
2010-06-16 11:51:39 +00:00
self . write ( cr , uid , ids , { ' state ' : ' cancel ' } , context = context )
2010-01-20 14:28:28 +00:00
return True
2010-10-27 12:49:59 +00:00
2011-12-05 13:21:02 +00:00
def button_draft ( self , cr , uid , ids , context = None ) :
self . write ( cr , uid , ids , { ' state ' : ' draft ' } , context = context )
return True
2010-10-14 09:57:26 +00:00
def write ( self , cr , uid , ids , vals , context = None ) :
if ' date ' in vals :
2010-10-15 16:53:15 +00:00
new_vals = { ' date_deadline ' : vals . get ( ' date ' ) }
2010-10-14 09:57:26 +00:00
obj_hr_eval_iterview = self . pool . get ( ' hr.evaluation.interview ' )
2010-10-15 16:53:15 +00:00
for evalutation in self . browse ( cr , uid , ids , context = context ) :
for survey_req in evalutation . survey_request_ids :
obj_hr_eval_iterview . write ( cr , uid , [ survey_req . id ] , new_vals , context = context )
2010-10-14 09:57:26 +00:00
return super ( hr_evaluation , self ) . write ( cr , uid , ids , vals , context = context )
2010-10-27 12:49:59 +00:00
2010-01-20 14:28:28 +00:00
hr_evaluation ( )
2010-03-05 12:21:31 +00:00
class survey_request ( osv . osv ) :
2010-07-03 10:21:52 +00:00
_inherit = " survey.request "
2010-03-05 12:21:31 +00:00
_columns = {
2011-11-08 06:20:07 +00:00
' is_evaluation ' : fields . boolean ( ' Is Appraisal? ' ) ,
2010-08-26 04:52:04 +00:00
}
2010-03-18 09:34:51 +00:00
2010-03-05 12:21:31 +00:00
survey_request ( )
class hr_evaluation_interview ( osv . osv ) :
2010-07-03 10:21:52 +00:00
_name = ' hr.evaluation.interview '
_inherits = { ' survey.request ' : ' request_id ' }
2010-09-20 13:15:05 +00:00
_rec_name = ' request_id '
2011-11-08 06:20:07 +00:00
_description = ' Appraisal Interview '
2010-03-05 12:21:31 +00:00
_columns = {
2010-08-12 19:29:33 +00:00
' request_id ' : fields . many2one ( ' survey.request ' , ' Request_id ' , ondelete = ' cascade ' , required = True ) ,
2010-04-07 09:54:57 +00:00
' user_to_review_id ' : fields . many2one ( ' hr.employee ' , ' Employee to Interview ' ) ,
2011-11-08 06:20:07 +00:00
' evaluation_id ' : fields . many2one ( ' hr_evaluation.evaluation ' , ' Appraisal Form ' ) ,
2010-08-20 11:30:54 +00:00
}
2010-03-05 12:21:31 +00:00
_defaults = {
2010-07-01 13:43:56 +00:00
' is_evaluation ' : True ,
2010-08-20 11:30:54 +00:00
}
2010-10-27 12:49:59 +00:00
2010-09-20 13:15:05 +00:00
def name_get ( self , cr , uid , ids , context = None ) :
2010-10-27 12:49:59 +00:00
if not ids :
2010-09-20 13:15:05 +00:00
return [ ]
reads = self . browse ( cr , uid , ids , context = context )
res = [ ]
for record in reads :
name = record . request_id . survey_id . title
res . append ( ( record [ ' id ' ] , name ) )
return res
2010-10-27 12:49:59 +00:00
2010-07-03 10:21:52 +00:00
def survey_req_waiting_answer ( self , cr , uid , ids , context = None ) :
2010-10-27 12:49:59 +00:00
self . write ( cr , uid , ids , { ' state ' : ' waiting_answer ' } , context = context )
2010-03-05 12:21:31 +00:00
return True
2010-06-30 12:45:20 +00:00
def survey_req_done ( self , cr , uid , ids , context = None ) :
2010-07-27 07:11:45 +00:00
hr_eval_obj = self . pool . get ( ' hr_evaluation.evaluation ' )
2010-06-30 12:45:20 +00:00
for id in self . browse ( cr , uid , ids , context = context ) :
2010-03-05 12:21:31 +00:00
flag = False
wating_id = 0
2010-07-01 13:33:02 +00:00
if not id . evaluation_id . id :
2012-08-07 11:34:14 +00:00
raise osv . except_osv ( _ ( ' Warning! ' ) , _ ( " You cannot start evaluation without Appraisal. " ) )
2010-07-27 07:11:45 +00:00
records = hr_eval_obj . browse ( cr , uid , [ id . evaluation_id . id ] , context = context ) [ 0 ] . survey_request_ids
2010-03-05 12:21:31 +00:00
for child in records :
2010-10-27 12:49:59 +00:00
if child . state == " draft " :
2010-03-05 12:21:31 +00:00
wating_id = child . id
continue
if child . state != " done " :
flag = True
if not flag and wating_id :
2010-07-27 07:11:45 +00:00
self . survey_req_waiting_answer ( cr , uid , [ wating_id ] , context = context )
self . write ( cr , uid , ids , { ' state ' : ' done ' } , context = context )
2010-03-05 12:21:31 +00:00
return True
2010-07-01 13:43:56 +00:00
2010-07-03 10:21:52 +00:00
def survey_req_draft ( self , cr , uid , ids , context = None ) :
self . write ( cr , uid , ids , { ' state ' : ' draft ' } , context = context )
2010-03-05 12:21:31 +00:00
return True
2010-07-03 10:21:52 +00:00
def survey_req_cancel ( self , cr , uid , ids , context = None ) :
self . write ( cr , uid , ids , { ' state ' : ' cancel ' } , context = context )
2010-03-05 12:21:31 +00:00
return True
2010-04-07 13:46:01 +00:00
def action_print_survey ( self , cr , uid , ids , context = None ) :
"""
If response is available then print this response otherwise print survey form ( print template of the survey ) .
@param self : The object pointer
@param cr : the current row , from the database cursor ,
@param uid : the current user ’ s ID for security checks ,
@param ids : List of Survey IDs
@param context : A standard dictionary for contextual values
2010-10-27 12:49:59 +00:00
@return : Dictionary value for print survey form .
2010-04-07 13:46:01 +00:00
"""
2010-11-23 07:05:05 +00:00
if context is None :
2010-04-07 13:46:01 +00:00
context = { }
2010-07-27 07:11:45 +00:00
record = self . browse ( cr , uid , ids , context = context )
2010-04-08 05:25:40 +00:00
record = record and record [ 0 ]
2010-07-03 10:21:52 +00:00
context . update ( { ' survey_id ' : record . survey_id . id , ' response_id ' : [ record . response . id ] , ' response_no ' : 0 , } )
2010-11-19 13:48:01 +00:00
value = self . pool . get ( " survey " ) . action_print_survey ( cr , uid , ids , context = context )
2010-04-23 07:24:58 +00:00
return value
2010-07-03 10:21:52 +00:00
2010-03-18 08:39:32 +00:00
hr_evaluation_interview ( )
2010-03-18 09:34:51 +00:00
2010-03-22 13:59:23 +00:00
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:1