[FIX] hr_recruitment: no crash when default stage not found

This commit is contained in:
Olivier Dony
2015-12-03 19:14:05 +01:00
parent 5fb29dedd1
commit 049c1c4e7a
@@ -228,10 +228,11 @@ class Applicant(models.Model):
department_id = job.department_id.id
user_id = job.user_id.id
if not self.stage_id:
stage_id = self.env['hr.recruitment.stage'].search([
stage_ids = self.env['hr.recruitment.stage'].search([
('job_ids', '=', job.id),
('fold', '=', False)
], order='sequence asc', limit=1).ids[0]
], order='sequence asc', limit=1).ids
stage_id = stage_ids[0] if stage_ids else False
return {'value': {
'department_id': department_id,