[FIX] hr_recruitment: temporary fix, about stage_set that was broken, and updated yml test files to be more verbose.

bzr revid: tde@openerp.com-20120523115236-scxkqef3giqsfzlx
This commit is contained in:
Thibault Delavallée
2012-05-23 13:52:36 +02:00
parent c7c1ac31e2
commit 86f2a63d11
2 changed files with 15 additions and 4 deletions
+12 -1
View File
@@ -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
@@ -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.