[IMP,FIX] hr_recruitment: Add field 'HR Responsible' field + 2 small fixes
- Add a field HR Responsible, who's the job responsible, not the recruitment responsible - Fix the read_group in `_compute_application_count` method - Only track subtypes for active employees
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<h2>Recruitment Process</h2>
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="row mt16 o_settings_container" name="recruitment_process_div">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box" title="Use interview forms tailored to each job position during the recruitment process. Select the form to use in the job position detail form. This relies on Survey app.">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_hr_recruitment_survey"/>
|
||||
|
||||
@@ -448,6 +448,7 @@
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='department_id']" position="after">
|
||||
<field name="user_id"/>
|
||||
<field name="hr_responsible_id"/>
|
||||
</xpath>
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button"
|
||||
|
||||
Reference in New Issue
Block a user