[IMP]Improve search view in all modules
[odoo/odoo.git] / addons / hr_recruitment / test / recruitment_process.yml
index 64e8ab6..841a49d 100644 (file)
@@ -1,7 +1,7 @@
 -
   In Order to test process of Recruitment,
 -
-  Applicant interested in job position. so He send resume by email.
+  An applicant is interested in the job position. So he sends a resume by email.
 -
   !python {model: mail.thread}: |
     import addons
@@ -9,36 +9,68 @@
     request_message = request_file.read()
     self.message_process(cr, uid, 'hr.applicant', request_message)
 -
-  After getting the mail, I check details of new applicant.
+  After getting the mail, I check the details of the new applicant.
 -
   !python {model: hr.applicant}: |
     applicant_ids = self.search(cr, uid, [('email_from','=', 'Mr. Richard Anderson <Richard_Anderson@yahoo.com>')])
     assert applicant_ids, "Applicant is not created after getting the mail"
     applicant = self.browse(cr, uid, applicant_ids[0], context=context)
-    assert applicant.name == "Application for the post of Jr.application Programmer", "Subject does not match"
-    assert applicant.state == "draft"
+    resume_ids = self.pool.get('ir.attachment').search(cr, uid, [('datas_fname','=','resume.doc'),('res_model','=',self._name),('res_id','=',applicant.id)])
+    assert applicant.name == "Application for the post of Jr.application Programmer.", "Applicant name does not match."
+    assert applicant.stage_id.id == ref('hr_recruitment.stage_job1'), "Stage should be 'Initial qualification' and is '%s'." % (applicant.stage_id.name)
+    assert applicant.state == "draft", "Applicant state should be 'draft'."
+    assert len(resume_ids), "Resume is not attached."
 -
-  I assign the Job position to the applicant
+  I refuse the applicant (hr_case_programmer)
+-
+  !python {model: hr.applicant}: |
+    self.case_cancel(cr, uid, [ref("hr_case_programmer")])
+-
+  I check the details of the refused applicant.
 -
   !python {model: hr.applicant}: |
-    self.write(cr, uid, [ref('hr_case_programmer')], {'job_id':ref('hr.job_jr_appli')})
+    applicant = self.browse(cr, uid, ref("hr_case_programmer"), context=context)
+    assert applicant.stage_id.id == ref('hr_recruitment.stage_job6'), "Stage should be 'Refused' and is %s." % (applicant.stage_id.name)
+    assert applicant.state == 'cancel', "Applicant is not in 'cancel' state."
 -
-  I open applicant for the Recruitment
+  I reset and re-open the previously refused applicant.
 -
-
   !python {model: hr.applicant}: |
+    self.case_reset(cr, uid, [ref("hr_case_programmer")])
     self.case_open(cr, uid, [ref("hr_case_programmer")])
 -
-  I start communication with applicant, first schedule phonecall.
+  I check the details of the re-opened applicant.
 -
-  !python {model: hr.recruitment.job2phonecall}: |
-     self.make_phonecall(cr, uid, [ref('hr_case_programmer')])
+  !python {model: hr.applicant}: |
+    applicant = self.browse(cr, uid, ref("hr_case_programmer"), context=context)
+    assert applicant.stage_id.id == ref('hr_recruitment.stage_job2'), "Stage should be 'First interview' and is '%s'." % (applicant.stage_id.name)
+    assert applicant.state == "open", "Applicant state should be 'open'."
+-
+  I assign the Job position to the applicant
+-
+  !python {model: hr.applicant}: |
+    self.write(cr, uid, [ref('hr_case_programmer')], {'job_id':ref('hr.job_developer')})
 -
   I schedule meeting with applicant for interview.
 -
   !python {model: hr.applicant}: |
      self.action_makeMeeting(cr, uid, [ref('hr_case_programmer')])
 -
+  I check Initial Qualification of applicant.
+-
+  !python {model: hr.applicant}: |
+     self.stage_next(cr, uid, [ref('hr_case_programmer')])
+-
+  I schedule First Interview of applicant.
+-
+  !python {model: hr.applicant}: |
+     self.stage_next(cr, uid, [ref('hr_case_programmer')])
+-
+  On a successful First Interview of applicant, I schedule Second Interview.
+-
+  !python {model: hr.applicant}: |
+     self.stage_next(cr, uid, [ref('hr_case_programmer')])
+-
   Applicant fillup the answer of the interview quetion.
 -
   !python {model: survey.question.wiz}: |
   !python {model: hr.applicant}: |
     self.action_print_survey(cr, uid, [ref('hr_case_programmer')])
 -
-  On a successful meeting with the applicant, I hired employee.
+  On a successful Second Interview of applicant Contract is Proposed to applicant.
 -
   !python {model: hr.applicant}: |
-     self.case_close(cr, uid, [ref('hr_case_programmer')])
+     self.stage_next(cr, uid, [ref('hr_case_programmer')])
+     self.stage_previous(cr, uid, [ref('hr_case_programmer')])
+-
+  I Hired Applicant.
+-
+  !python {model: hr.applicant}: |
+     self.case_close_with_emp(cr, uid, [ref('hr_case_programmer')])
 -
   I check that applicant is "Hired".
 -
-  !assert {model: hr.applicant, id: hr_case_programmer}:
-    - state == 'done'
\ No newline at end of file
+  !assert {model: hr.applicant, id: hr_case_programmer, string: Applicant state is done}:
+    - state == 'done'
+-
+  I do not give employment to the hired the applicant.
+-
+  !python {model: hired.employee}: |
+    context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
+    emp_id = self.create(cr, uid, {}, context=context)
+    self.case_close(cr, uid, [emp_id], context=context)
+-
+  Now I give employment to hired applicant .
+-
+  !python {model: hr.applicant}: |
+     hired_emp_obj = self.pool.get('hired.employee')
+     self.case_reset(cr, uid, [ref("hr_case_programmer")])
+     self.case_open(cr, uid, [ref("hr_case_programmer")])
+     context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
+     emp_hr_id = hired_emp_obj.create(cr, uid, {}, context=context)
+     hired_emp_obj.case_close_with_emp(cr, uid, [emp_hr_id], context=context)
+-
+  Now hired employee want to be a partner of company.
+-
+  !record {model: hr.recruitment.partner.create, id: hr_recruitment_partner_id1 }:
+-
+  !python {model: hr.recruitment.partner.create}: |
+    context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
+    self.make_order(cr, uid, [ref("hr_recruitment_partner_id1")], context=context)