summaryrefslogtreecommitdiff
path: root/addons/hr_recruitment/models/hr_recruitment.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2015-12-10 13:05:58 +0100
committerChristophe Simonis <chs@odoo.com>2015-12-10 13:05:58 +0100
commit82a495eed52a9f42e5b88caa52c20a85f8d81ce3 (patch)
tree6c5e8cc0247d5fe08d24e9abae38fe353fbebc56 /addons/hr_recruitment/models/hr_recruitment.py
parent0bc2ddae784bf80c4c809d8b7f6d642d576f92a1 (diff)
parent4022493c0b85f966e499b6c03ac7cce5556f15e6 (diff)
[MERGE] forward port of branch saas-7 up to 4022493
Diffstat (limited to 'addons/hr_recruitment/models/hr_recruitment.py')
-rw-r--r--addons/hr_recruitment/models/hr_recruitment.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/addons/hr_recruitment/models/hr_recruitment.py b/addons/hr_recruitment/models/hr_recruitment.py
index 60faef49674..a6cd84d0445 100644
--- a/addons/hr_recruitment/models/hr_recruitment.py
+++ b/addons/hr_recruitment/models/hr_recruitment.py
@@ -86,10 +86,12 @@ class Applicant(models.Model):
def _default_stage_id(self):
if self._context.get('default_job_id'):
- return self.env['hr.recruitment.stage'].search([
+ ids = self.env['hr.recruitment.stage'].search([
('job_ids', '=', self._context['default_job_id']),
('fold', '=', False)
- ], order='sequence asc', limit=1).ids[0]
+ ], order='sequence asc', limit=1).ids
+ if ids:
+ return ids[0]
return False
def _default_company_id(self):
@@ -226,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,