diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 5a78b2e6be1..e82d83a44c0 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -232,12 +232,23 @@ class hr_applicant(crm.crm_case, osv.osv): def stage_find(self, cr, uid, section_id, domain=[], order='sequence', context=None): domain = list(domain) if section_id: - domain.append(('department_id', '=', section_id)) + pass + #domain.append(('department_id', '=', section_id)) stage_ids = self.pool.get('hr.recruitment.stage').search(cr, uid, domain, order=order, context=context) if stage_ids: return stage_ids[0] return False + def stage_set_with_state_name(self, cr, uid, cases, state_name, context=None): + """ TODO + """ + for case in cases: + department_id = case.department_id.id if case.department_id else None + stage_id = self.stage_find(cr, uid, department_id, [('state', '=', state_name)], context=context) + if stage_id: + self.stage_set(cr, uid, [case.id], stage_id, context=context) + return True + def stage_previous(self, cr, uid, ids, context=None): """ This function computes previous stage for case from its current stage using available stage for that case type diff --git a/addons/hr_recruitment/test/recruitment_process.yml b/addons/hr_recruitment/test/recruitment_process.yml index e856747ed99..70c078f7b6a 100644 --- a/addons/hr_recruitment/test/recruitment_process.yml +++ b/addons/hr_recruitment/test/recruitment_process.yml @@ -16,8 +16,8 @@ assert applicant_ids, "Applicant is not created after getting the mail" applicant = self.browse(cr, uid, applicant_ids[0], context=context) 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.", "Subject does not match" - assert applicant.state == "draft" + assert applicant.name == "Application for the post of Jr.application Programmer.", "Applicant name does not match." + assert applicant.state == "draft", "Applicant state should be 'draft'." assert len(resume_ids), "Resume does not attached." - I refuse applicant for the Recruitment. @@ -91,7 +91,7 @@ - I check that applicant is "Hired". - - !assert {model: hr.applicant, id: hr_case_programmer}: + !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.