[IMP]Improve search view in all modules
[odoo/odoo.git] / addons / hr_recruitment / test / recruitment_process.yml
1 -
2   In Order to test process of Recruitment,
3 -
4   An applicant is interested in the job position. So he sends a resume by email.
5 -
6   !python {model: mail.thread}: |
7     import addons
8     request_file = open(addons.get_module_resource('hr_recruitment','test', 'resume.eml'),'rb')
9     request_message = request_file.read()
10     self.message_process(cr, uid, 'hr.applicant', request_message)
11 -
12   After getting the mail, I check the details of the new applicant.
13 -
14   !python {model: hr.applicant}: |
15     applicant_ids = self.search(cr, uid, [('email_from','=', 'Mr. Richard Anderson <Richard_Anderson@yahoo.com>')])
16     assert applicant_ids, "Applicant is not created after getting the mail"
17     applicant = self.browse(cr, uid, applicant_ids[0], context=context)
18     resume_ids = self.pool.get('ir.attachment').search(cr, uid, [('datas_fname','=','resume.doc'),('res_model','=',self._name),('res_id','=',applicant.id)])
19     assert applicant.name == "Application for the post of Jr.application Programmer.", "Applicant name does not match."
20     assert applicant.stage_id.id == ref('hr_recruitment.stage_job1'), "Stage should be 'Initial qualification' and is '%s'." % (applicant.stage_id.name)
21     assert applicant.state == "draft", "Applicant state should be 'draft'."
22     assert len(resume_ids), "Resume is not attached."
23 -
24   I refuse the applicant (hr_case_programmer)
25 -
26   !python {model: hr.applicant}: |
27     self.case_cancel(cr, uid, [ref("hr_case_programmer")])
28 -
29   I check the details of the refused applicant.
30 -
31   !python {model: hr.applicant}: |
32     applicant = self.browse(cr, uid, ref("hr_case_programmer"), context=context)
33     assert applicant.stage_id.id == ref('hr_recruitment.stage_job6'), "Stage should be 'Refused' and is %s." % (applicant.stage_id.name)
34     assert applicant.state == 'cancel', "Applicant is not in 'cancel' state."
35 -
36   I reset and re-open the previously refused applicant.
37 -
38   !python {model: hr.applicant}: |
39     self.case_reset(cr, uid, [ref("hr_case_programmer")])
40     self.case_open(cr, uid, [ref("hr_case_programmer")])
41 -
42   I check the details of the re-opened applicant.
43 -
44   !python {model: hr.applicant}: |
45     applicant = self.browse(cr, uid, ref("hr_case_programmer"), context=context)
46     assert applicant.stage_id.id == ref('hr_recruitment.stage_job2'), "Stage should be 'First interview' and is '%s'." % (applicant.stage_id.name)
47     assert applicant.state == "open", "Applicant state should be 'open'."
48 -
49   I assign the Job position to the applicant
50 -
51   !python {model: hr.applicant}: |
52     self.write(cr, uid, [ref('hr_case_programmer')], {'job_id':ref('hr.job_developer')})
53 -
54   I schedule meeting with applicant for interview.
55 -
56   !python {model: hr.applicant}: |
57      self.action_makeMeeting(cr, uid, [ref('hr_case_programmer')])
58 -
59   I check Initial Qualification of applicant.
60 -
61   !python {model: hr.applicant}: |
62      self.stage_next(cr, uid, [ref('hr_case_programmer')])
63 -
64   I schedule First Interview of applicant.
65 -
66   !python {model: hr.applicant}: |
67      self.stage_next(cr, uid, [ref('hr_case_programmer')])
68 -
69   On a successful First Interview of applicant, I schedule Second Interview.
70 -
71   !python {model: hr.applicant}: |
72      self.stage_next(cr, uid, [ref('hr_case_programmer')])
73 -
74   Applicant fillup the answer of the interview quetion.
75 -
76   !python {model: survey.question.wiz}: |
77     ctx = context.copy()
78     ctx.update({'active_model': 'hr.applicant', 'active_id': ref("hr_case_programmer"), 'active_ids': [ref("hr_case_programmer")], 'survey_id': ref("survey_job_0")})
79     self.fields_view_get(cr, uid, ref("survey.view_survey_question_message"),"form", context=ctx)
80     vals = self.default_get(cr, uid , [], context=ctx)
81     self.create(cr, uid, vals, context=ctx)
82     self.action_new_page(cr, uid, [ref("survey_job_0")], context=ctx)
83 -
84   I print Applicant fill up the interview quetion
85 -
86   !python {model: hr.applicant}: |
87     self.action_print_survey(cr, uid, [ref('hr_case_programmer')])
88 -
89   On a successful Second Interview of applicant Contract is Proposed to applicant.
90 -
91   !python {model: hr.applicant}: |
92      self.stage_next(cr, uid, [ref('hr_case_programmer')])
93      self.stage_previous(cr, uid, [ref('hr_case_programmer')])
94 -
95   I Hired Applicant.
96 -
97   !python {model: hr.applicant}: |
98      self.case_close_with_emp(cr, uid, [ref('hr_case_programmer')])
99 -
100   I check that applicant is "Hired".
101 -
102   !assert {model: hr.applicant, id: hr_case_programmer, string: Applicant state is done}:
103     - state == 'done'
104 -
105   I do not give employment to the hired the applicant.
106 -
107   !python {model: hired.employee}: |
108     context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
109     emp_id = self.create(cr, uid, {}, context=context)
110     self.case_close(cr, uid, [emp_id], context=context)
111 -
112   Now I give employment to hired applicant .
113 -
114   !python {model: hr.applicant}: |
115      hired_emp_obj = self.pool.get('hired.employee')
116      self.case_reset(cr, uid, [ref("hr_case_programmer")])
117      self.case_open(cr, uid, [ref("hr_case_programmer")])
118      context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
119      emp_hr_id = hired_emp_obj.create(cr, uid, {}, context=context)
120      hired_emp_obj.case_close_with_emp(cr, uid, [emp_hr_id], context=context)
121 -
122   Now hired employee want to be a partner of company.
123 -
124   !record {model: hr.recruitment.partner.create, id: hr_recruitment_partner_id1 }:
125 -
126   !python {model: hr.recruitment.partner.create}: |
127     context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
128     self.make_order(cr, uid, [ref("hr_recruitment_partner_id1")], context=context)