diff --git a/addons/hr_recruitment/models/hr_job.py b/addons/hr_recruitment/models/hr_job.py index 989b83ee6c0..e7648bcfe75 100644 --- a/addons/hr_recruitment/models/hr_job.py +++ b/addons/hr_recruitment/models/hr_job.py @@ -20,6 +20,7 @@ class Job(models.Model): 'hr.employee', related='department_id.manager_id', string="Department Manager", readonly=True, store=True) user_id = fields.Many2one('res.users', "Recruitment Responsible", track_visibility='onchange') + hr_responsible_id = fields.Many2one('res.users', "HR Responsible", track_visibility='onchange') document_ids = fields.One2many('ir.attachment', compute='_compute_document_ids', string="Applications") documents_count = fields.Integer(compute='_compute_document_ids', string="Documents") alias_id = fields.Many2one( @@ -47,7 +48,7 @@ class Job(models.Model): @api.multi def _compute_application_count(self): - read_group_result = self.env['hr.applicant'].read_group([('job_id', '=', self.id)], ['job_id'], ['job_id']) + read_group_result = self.env['hr.applicant'].read_group([('job_id', 'in', self.ids)], ['job_id'], ['job_id']) result = dict((data['job_id'][0], data['job_id_count']) for data in read_group_result) for job in self: job.application_count = result.get(job.id, 0) diff --git a/addons/hr_recruitment/models/hr_recruitment.py b/addons/hr_recruitment/models/hr_recruitment.py index 766fc4ccae9..f5e164a4aff 100644 --- a/addons/hr_recruitment/models/hr_recruitment.py +++ b/addons/hr_recruitment/models/hr_recruitment.py @@ -327,7 +327,7 @@ class Applicant(models.Model): @api.multi def _track_subtype(self, init_values): record = self[0] - if 'emp_id' in init_values and record.emp_id: + if 'emp_id' in init_values and record.emp_id and record.emp_id.active: return 'hr_recruitment.mt_applicant_hired' elif 'stage_id' in init_values and record.stage_id and record.stage_id.sequence <= 1: return 'hr_recruitment.mt_applicant_new' diff --git a/addons/hr_recruitment/views/hr_recruitment_config_settings_views.xml b/addons/hr_recruitment/views/hr_recruitment_config_settings_views.xml index 6890b520e97..54499005565 100644 --- a/addons/hr_recruitment/views/hr_recruitment_config_settings_views.xml +++ b/addons/hr_recruitment/views/hr_recruitment_config_settings_views.xml @@ -26,7 +26,7 @@