Merge pull request #56 from yvaucher/7.0-fix-1319109
[odoo/odoo.git] / addons / hr_evaluation / test / test_hr_evaluation.yml
1 -
2   I set the "Employee Evaluation" survey in open state.
3 -
4   !python {model: survey}: |
5     self.survey_open(cr, uid, [ref("survey_2")], context)
6 -
7   I check that state of "Employee Evaluation" survey is Open.
8 -
9   !assert {model: survey, id: survey_2, severity: error, string: Survey should be in OPen state}:
10     - state == 'open'
11 -
12   I start the evaluation process by click on "Start Evaluation" button.
13 -
14   !python {model: hr_evaluation.evaluation}: |
15      self.button_plan_in_progress(cr, uid, [ref('hr_evaluation_evaluation_0')])
16 -
17   I check that state is "Plan in progress".
18 -
19   !assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0, severity: error, string: Evaluation should be 'Plan in progress' state}:
20     - state == 'wait'
21 -
22   I find a mistake on evaluation form. So I cancel the evaluation and again start it.
23 -
24   !python {model: hr_evaluation.evaluation}: |
25     evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0') , context)
26     self.button_cancel(cr, uid, [ref('hr_evaluation_evaluation_0')])
27     assert evaluation.state == 'cancel', 'Evaluation should be in cancel state'
28     self.button_draft(cr, uid, [ref('hr_evaluation_evaluation_0')])
29     evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0') , context)
30     assert evaluation.state == 'draft', 'Evaluation should be in draft state'
31     self.button_plan_in_progress(cr, uid, [ref('hr_evaluation_evaluation_0')])
32 -
33   I check that state is "Plan in progress" and "Interview Request" record is created
34 -
35   !python {model: hr_evaluation.evaluation}: |
36     interview_obj = self.pool.get('hr.evaluation.interview')
37     evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0') , context)
38     assert evaluation.state == 'wait', "Evaluation should be 'Plan in progress' state"
39     interview_ids = interview_obj.search(cr, uid, [('evaluation_id','=', ref('hr_evaluation_evaluation_0'))])
40     assert len(interview_ids), "Interview evaluation survey not created"
41 -
42   Give answer of the first page in "Employee Evaluation" survey.
43 -
44   !python {model: survey.question.wiz}: |
45     name_wiz_obj=self.pool.get('survey.name.wiz')
46     interview_obj = self.pool.get('hr.evaluation.interview')
47     interview_ids = interview_obj.search(cr, uid, [('evaluation_id','=', ref('hr_evaluation_evaluation_0'))])
48     assert len(interview_ids), "Interview evaluation survey not created"
49     ctx = {'active_model':'hr.evaluation.interview', 'active_id': interview_ids[0], 'active_ids': [interview_ids], 'survey_id': ref("survey_2")}
50     name_id = name_wiz_obj.create(cr, uid, {'survey_id': ref("survey_2")})
51     ctx ["sur_name_id"] = name_id
52     self.create(cr, uid, {str(ref("survey_question_2")) +"_" +str(ref("survey_answer_1")) + "_multi" :'tpa',
53                str(ref("survey_question_2")) +"_" +str(ref("survey_answer_10")) + "_multi" :'application eng',
54                str(ref("survey_question_2")) +"_" +str(ref("survey_answer_20")) + "_multi" :'3',
55                str(ref("survey_question_2")) +"_" +str(ref("survey_answer_25")) + "_multi" :'2011-12-02 16:42:00',
56                str(ref("survey_question_2")) +"_" +str(ref("survey_answer_43")) + "_multi" :'HR',
57                }, context = ctx)
58 -
59   I close this Evaluation survey by giving answer of questions.
60 -
61   !python {model: hr_evaluation.evaluation}: |
62     interview_obj = self.pool.get('hr.evaluation.interview')
63     evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0'))
64     interview_obj.survey_req_done(cr, uid, [r.id for r in evaluation.survey_request_ids])
65     for survey in evaluation.survey_request_ids:
66         interview = interview_obj.browse(cr, uid, survey.id, context)
67         assert interview.state == "done", 'survey must be in done state'
68 -
69   I print the evaluation.
70 -
71   !python {model: hr_evaluation.evaluation}: |
72     evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0'))
73     self.pool.get('hr.evaluation.interview').action_print_survey(cr, uid, [r.id for r in evaluation.survey_request_ids])
74 -
75   I click on "Final Validation" button to finalise evaluation.
76 -
77   !python {model: hr_evaluation.evaluation}: |
78     self.button_final_validation(cr, uid, [ref("hr_evaluation_evaluation_0")])
79 -
80   I check that state is "Waiting Appreciation".
81 -
82   !assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}:
83       - state == 'progress'
84 -
85   Give Rating "Meet expectations" by selecting overall Rating.
86 -
87   !record {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}:
88     rating: '2'
89 -
90   I close this Evaluation by click on "Done" button of this wizard.
91 -
92   !python {model: hr_evaluation.evaluation}: |
93     self.button_done(cr, uid, [ref("hr_evaluation_evaluation_0")])
94 -
95   I check that state of Evaluation is done.
96 -
97   !assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0, severity: error, string: Evaluation should be in done state}:
98       - state == 'done'
99 -
100   Print Evaluations Statistics Report
101 -
102   !python {model: hr.evaluation.report}: |
103     import netsvc, tools, os, time
104     ctx={}
105     data_dict={'state': 'done', 'rating': 2, 'employee_id': ref("hr.employee_fp")}
106     from tools import test_reports
107     test_reports.try_report_action(cr, uid, 'hr_evaluation_evaluation_0',wiz_data=data_dict, context=ctx, our_module='hr_evaluation')