From 647247e3ff5c6dd287973cf88e4ffa4504bd77f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20=28avd=29?= Date: Wed, 22 Apr 2020 13:51:12 +0000 Subject: [PATCH] [IMP] hr_recruitment: Improve global UX (back2basics) Multiple small changes/fixes to the hr_recruitment module to provide a better base for later improvements. The linkedin recruitment source is only added by default to new records, existing records remain unchanged. For the google map in the email template, since it requires an API_Key and only a minority of companies will get this key, it was decided that it is better to remove it from the template. Now that linkedin is added to job positions by default, deleting a job position currently does not delete the related linkedin source. So after removing 10 job positions, there are still 10 linked in source in the database. This commit fixes that. Add three additionnal utm_sources. Add linkedin as a source job to demo job position to be consistent with no-demo data db. closes odoo/odoo#50076 Taskid: 2196767 Related: odoo/enterprise#10778 Signed-off-by: Yannick Tivisse (yti) --- .../data/hr_recruitment_data.xml | 16 ++------- .../data/hr_recruitment_demo.xml | 35 +++++++++++++++++++ addons/hr_recruitment/models/hr_job.py | 10 +++++- .../hr_recruitment/models/hr_recruitment.py | 5 ++- addons/hr_recruitment/views/hr_job_views.xml | 8 +---- .../views/hr_recruitment_views.xml | 23 ++++++------ addons/utm/data/utm_data.xml | 12 +++++++ 7 files changed, 74 insertions(+), 35 deletions(-) diff --git a/addons/hr_recruitment/data/hr_recruitment_data.xml b/addons/hr_recruitment/data/hr_recruitment_data.xml index 2428628ab79..0059e324493 100644 --- a/addons/hr_recruitment/data/hr_recruitment_data.xml +++ b/addons/hr_recruitment/data/hr_recruitment_data.xml @@ -116,7 +116,7 @@

What is the next step?

- We usually answer applications within 3 days. + We usually answer applications within a few days.

The next step is either a call or a meeting in our offices.
@@ -156,12 +156,6 @@ % set location = '%s, %s' % (location, object.job_id.address_id.country_id.name) % endif
- - % if object.job_id.address_id: - - - - % endif @@ -214,7 +208,7 @@ % endif

What is the next step?

- We usually answer applications within 3 days.

+ We usually answer applications within a few days.

Feel free to contact us if you want a faster feedback or if you don't get news from us quickly enough (just reply to this email). @@ -250,11 +244,6 @@ % set location = '%s, %s' % (location, object.job_id.address_id.country_id.name) % endif
- % if object.job_id.address_id: - - - - % endif @@ -362,7 +351,6 @@ First Interview - 2 diff --git a/addons/hr_recruitment/data/hr_recruitment_demo.xml b/addons/hr_recruitment/data/hr_recruitment_demo.xml index 193cfe6b3f4..1bd63aa1f2b 100644 --- a/addons/hr_recruitment/data/hr_recruitment_demo.xml +++ b/addons/hr_recruitment/data/hr_recruitment_demo.xml @@ -40,6 +40,41 @@ 6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sales Manager diff --git a/addons/hr_recruitment/models/hr_job.py b/addons/hr_recruitment/models/hr_job.py index 5b7efdc78c8..aefd550d694 100644 --- a/addons/hr_recruitment/models/hr_job.py +++ b/addons/hr_recruitment/models/hr_job.py @@ -108,7 +108,15 @@ class Job(models.Model): @api.model def create(self, vals): vals['favorite_user_ids'] = vals.get('favorite_user_ids', []) + [(4, self.env.uid)] - return super(Job, self).create(vals) + new_job = super(Job, self).create(vals) + utm_linkedin = self.env.ref("utm.utm_source_linkedin", raise_if_not_found=False) + if utm_linkedin: + source_vals = { + 'source_id': utm_linkedin.id, + 'job_id': new_job.id, + } + self.env['hr.recruitment.source'].create(source_vals) + return new_job def _creation_subtype(self): return self.env.ref('hr_recruitment.mt_job_new') diff --git a/addons/hr_recruitment/models/hr_recruitment.py b/addons/hr_recruitment/models/hr_recruitment.py index a17e1a5e957..3623eaebd2c 100644 --- a/addons/hr_recruitment/models/hr_recruitment.py +++ b/addons/hr_recruitment/models/hr_recruitment.py @@ -22,7 +22,7 @@ class RecruitmentSource(models.Model): source_id = fields.Many2one('utm.source', "Source", ondelete='cascade', required=True) email = fields.Char(related='alias_id.display_name', string="Email", readonly=True) - job_id = fields.Many2one('hr.job', "Job ID") + job_id = fields.Many2one('hr.job', "Job", ondelete='cascade') alias_id = fields.Many2one('mail.alias', "Alias ID") def create_alias(self): @@ -44,7 +44,6 @@ class RecruitmentSource(models.Model): source.alias_id = self.env['mail.alias'].create(vals) source.name = source.source_id.name - class RecruitmentStage(models.Model): _name = "hr.recruitment.stage" _description = "Recruitment Stages" @@ -97,7 +96,7 @@ class Applicant(models.Model): _order = "priority desc, id desc" _inherit = ['mail.thread.cc', 'mail.activity.mixin', 'utm.mixin'] - name = fields.Char("Subject / Application Name", required=True) + name = fields.Char("Subject / Application Name", required=True, help="Email subject for applications sent via email") active = fields.Boolean("Active", default=True, help="If the active field is set to false, it will allow you to hide the case without removing it.") description = fields.Text("Description") email_from = fields.Char("Email", size=128, help="Applicant email", compute='_compute_partner_phone_email', diff --git a/addons/hr_recruitment/views/hr_job_views.xml b/addons/hr_recruitment/views/hr_job_views.xml index 462df73223c..9f874cf8eab 100644 --- a/addons/hr_recruitment/views/hr_job_views.xml +++ b/addons/hr_recruitment/views/hr_job_views.xml @@ -69,7 +69,7 @@ @@ -102,12 +102,6 @@ - - - - - - diff --git a/addons/hr_recruitment/views/hr_recruitment_views.xml b/addons/hr_recruitment/views/hr_recruitment_views.xml index b4fc4ad76b2..3062ace075b 100644 --- a/addons/hr_recruitment/views/hr_recruitment_views.xml +++ b/addons/hr_recruitment/views/hr_recruitment_views.xml @@ -27,21 +27,23 @@ - + - - + + - - - + + + + + - + - + @@ -201,7 +203,7 @@ - + hr.recruitment.source - + +