summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYannick Tivisse <yti@odoo.com>2017-04-26 11:19:43 +0200
committerYannick Tivisse <yti@odoo.com>2017-04-26 15:08:09 +0200
commitf89ac984e7bfd204fdf83668302008586ca0550a (patch)
tree1b2fffa6490930931d100a6716c6fec102fd58de
parente18e6b3c900915a639fe4d24563a16e5404471f5 (diff)
[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
-rw-r--r--addons/hr_recruitment/models/hr_job.py3
-rw-r--r--addons/hr_recruitment/models/hr_recruitment.py2
-rw-r--r--addons/hr_recruitment/views/hr_recruitment_config_settings_views.xml2
-rw-r--r--addons/hr_recruitment/views/hr_recruitment_views.xml1
4 files changed, 5 insertions, 3 deletions
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 @@
</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"/>
diff --git a/addons/hr_recruitment/views/hr_recruitment_views.xml b/addons/hr_recruitment/views/hr_recruitment_views.xml
index 0173d691441..70b539e60a5 100644
--- a/addons/hr_recruitment/views/hr_recruitment_views.xml
+++ b/addons/hr_recruitment/views/hr_recruitment_views.xml
@@ -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"