[IMP] hr_evaluation: Imrpoved yaml. Added some tests for remaining methods.
[odoo/odoo.git] / addons / hr_evaluation / test / test_hr_evaluation.yml
1 -
2   In order to test hr_evaluation module for OpenERP, I will create plan then create evaluation under that plan.
3 -
4
5   I create new Department.
6 -
7   !record {model: hr.department, id: hr_department_rd0}:
8     manager_id: base.user_root
9     name: 'R & D'
10 -
11   I create a new employee.
12 -
13   !record {model: hr.employee, id: hr_employee_employee0}:
14     address_home_id: base.res_partner_address_1
15     company_id: base.main_company
16     gender: male
17     marital: single
18     name: Mark Johnson
19     user_id: base.user_root
20     department_id: 'hr_department_rd0'
21 -
22   I create another new employee and assign first one as it's Manager.
23 -
24   !record {model: hr.employee, id: hr_employee_employee1}:
25     address_home_id: base.res_partner_address_3000
26     company_id: base.main_company
27     gender: male
28     name: Phil Graves
29     user_id: base.user_demo
30     parent_id: 'hr_employee_employee0'
31
32 -
33   I Create an "Employee Evaluation" survey for Manager's Evaluation Plan.
34 -
35     !record {model: 'survey', id: survey_0}:
36         title: 'Employee Evaluation'
37         max_response_limit: 20
38         response_user: 2
39 -
40   I Create an "Employee Evaluation" page in "Employee Evaluation" survey.
41 -
42     !record {model: 'survey.page', id: survey_employee_page_0}:
43         title: 'Employee Evaluation'
44         survey_id: survey_0
45 -
46   I Create "What is your Name" question in "Employee Evaluation" survey page.
47 -
48     !record {model: 'survey.question', id: survey_p_question_0}:
49         question: 'What is your Name?'
50         type: 'single_textbox'
51         sequence: 1
52         page_id: survey_employee_page_0
53 -
54   I Create "What is your gender" Question in "Employee Evaluation" survey page.
55 -
56     !record {model: 'survey.question', id: survey_p_question_1}:
57         question: 'What is your gender?'
58         type: multiple_choice_only_one_ans
59         sequence: 2
60         is_require_answer: true
61         page_id: survey_employee_page_0
62 -
63   I Create "Male" answer in question "What is your gender?"
64 -
65     !record {model: 'survey.answer', id: survey_p_1_1}:
66         answer: 'Male'
67         sequence: 1
68         question_id : survey_p_question_1
69 -
70   I Create "Female" answer in question "What is your gender?"
71 -
72     !record {model: 'survey.answer', id: survey_p_1_2}:
73         answer: 'Female'
74         sequence: 2
75         question_id : survey_p_question_1
76
77 -
78   I set the survey in open state.
79 -
80   !python {model: survey}: |
81        self.survey_open(cr, uid, [ref("survey_0")], context)
82
83 -
84   I create an Evaluation plan and select "Employee Evaluation" survey for "Send to Subordinates" and "Final interview with Manager" Phase.
85 -
86   !record {model: hr_evaluation.plan, id: hr_evaluation_plan_managersplan0}:
87     company_id: base.main_company
88     month_first: 3
89     month_next: 6
90     name: Manager's  Plan
91     phase_ids:
92       - action: bottom-up
93         name: Send to Subordinates
94         survey_id: 'survey_0'
95       - action: top-down
96         name: Final Interview with manager
97         sequence: 2
98         survey_id: 'survey_0'
99 -
100   I assign the evaluation plan to the employee "Mark Johnson".
101 -
102   !python {model: hr.employee}: |
103     res = self.onchange_evaluation_plan_id(cr, uid, [ref('hr_employee_employee0')], ref('hr_evaluation_plan_managersplan0'), False, None)
104 -
105   I create an Evaluation for employee under "Manager Evaluation Plan".
106 -
107   !record {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}:
108     date: !eval time.strftime('%Y-%m-%d')
109     employee_id: 'hr_employee_employee1'
110     plan_id: 'hr_evaluation_plan_managersplan0'
111     progress: 0.0
112     state: draft
113 -
114   I change the employee on Evaluation.
115 -
116   !python {model: hr_evaluation.evaluation}: |
117     self.onchange_employee_id(cr, uid, [ref('hr_evaluation_evaluation_0')], ref('hr_employee_employee0'), None)
118 -
119   I start the evaluation process by click on "Start Evaluation" button.
120 -
121   !python {model: hr_evaluation.evaluation}: |
122      self.button_plan_in_progress(cr, uid, [ref('hr_evaluation_evaluation_0')])
123 -
124   I find a mistake on evaluation form. So I cancel the evaluation and again start it.
125 -
126   !python {model: hr_evaluation.evaluation}: |
127      self.button_cancel(cr, uid, [ref('hr_evaluation_evaluation_0')])
128      self.button_draft(cr, uid, [ref('hr_evaluation_evaluation_0')])
129      self.button_plan_in_progress(cr, uid, [ref('hr_evaluation_evaluation_0')])
130 -
131   I close this survey request by giving answer of survey question.
132 -
133   !python {model: hr_evaluation.evaluation}: |
134     evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0'))
135     self.pool.get('hr.evaluation.interview').survey_req_done(cr, uid, [r.id for r in evaluation.survey_request_ids])
136 -
137   I print the survey.
138 -
139   !python {model: hr_evaluation.evaluation}: |
140     evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0'))
141     self.pool.get('hr.evaluation.interview').action_print_survey(cr, uid, [r.id for r in evaluation.survey_request_ids])
142 -
143   I click on "Final Validation" button to finalise evaluation.
144 -
145   !python {model: hr_evaluation.evaluation}: |
146     self.button_final_validation(cr, uid, [ref("hr_evaluation.hr_evaluation_evaluation_0")],
147       {"active_ids": [ref("hr_evaluation.menu_open_view_hr_evaluation_tree")]})
148
149 -
150   I check that state is "Final Validation".
151 -
152   !assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}:
153       - state == 'progress'
154 -
155   Give Rating "Meet expectations" by selecting overall Rating.
156 -
157   !record {model: hr_evaluation.evaluation, id: hr_evaluation.hr_evaluation_evaluation_0}:
158     rating: '2'
159
160 -
161   I close this Evaluation by click on "Done" button of this wizard.
162 -
163   !python {model: hr_evaluation.evaluation}: |
164     self.button_done(cr, uid, [ref("hr_evaluation.hr_evaluation_evaluation_0")], {"active_ids": [ref("hr_evaluation.menu_open_view_hr_evaluation_tree")]})