From fb320856c099815d0a4e22abbf75eca5b5571383 Mon Sep 17 00:00:00 2001 From: "Jurgen (jugj)" Date: Wed, 21 Jun 2023 14:14:51 +0200 Subject: [PATCH] [IMP] (website_)hr_recruitment : Improve UX In this PR we'll add the following UX improvements : - Drop the useless responsible_id field from hr_job - Include applicant attachments in the meeting when scheduling an interview - Several tooltip and default value changes task-3380150 closes odoo/odoo#125932 Related: odoo/upgrade#4808 Signed-off-by: Sofie Gvaladze (sgv) --- addons/hr/models/hr_job.py | 3 ++- addons/hr_recruitment/models/calendar.py | 21 +++++++++++++++++++ addons/hr_recruitment/models/hr_applicant.py | 1 + addons/hr_recruitment/models/hr_job.py | 5 +---- .../views/hr_applicant_views.xml | 9 ++++++-- .../views/hr_applicant_views.xml | 3 --- .../website_hr_recruitment/models/hr_job.py | 2 +- .../views/hr_job_views.xml | 4 ++-- .../website_hr_recruitment_templates.xml | 6 +++--- 9 files changed, 38 insertions(+), 16 deletions(-) diff --git a/addons/hr/models/hr_job.py b/addons/hr/models/hr_job.py index be29f8f73bb..8488087c489 100644 --- a/addons/hr/models/hr_job.py +++ b/addons/hr/models/hr_job.py @@ -24,7 +24,8 @@ class Job(models.Model): no_of_hired_employee = fields.Integer(string='Hired Employees', copy=False, help='Number of hired employees for this job position during recruitment phase.') employee_ids = fields.One2many('hr.employee', 'job_id', string='Employees', groups='base.group_user') - description = fields.Html(string='Job Description', sanitize_attributes=False) + description = fields.Html(string='Job Description', sanitize_attributes=False, + default="Perform assigned responsibilities, collaborate with team members, and adhere to company policies. Strong communication, problem-solving, and work ethic required. Adaptability, initiative, and willingness to learn are valued.") requirements = fields.Text('Requirements') department_id = fields.Many2one('hr.department', string='Department', check_company=True) company_id = fields.Many2one('res.company', string='Company', default=lambda self: self.env.company) diff --git a/addons/hr_recruitment/models/calendar.py b/addons/hr_recruitment/models/calendar.py index 3ada239876e..6a3c2583e70 100644 --- a/addons/hr_recruitment/models/calendar.py +++ b/addons/hr_recruitment/models/calendar.py @@ -2,12 +2,33 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models +from odoo.exceptions import AccessError class CalendarEvent(models.Model): """ Model for Calendar Event """ _inherit = 'calendar.event' + @api.model_create_multi + def create(self, vals_list): + events = super(CalendarEvent, self).create(vals_list) + try: + self.env['hr.applicant'].check_access_rights('read') + except AccessError: + return events + + if "default_applicant_id" in self.env.context: + applicant_attachments = self.env['hr.applicant'].browse(self.env.context['default_applicant_id']).attachment_ids + for event in events: + self.env['ir.attachment'].create([{ + 'name': att.name, + 'type': 'binary', + 'datas': att.datas, + 'res_model': event._name, + 'res_id': event.id + } for att in applicant_attachments]) + return events + @api.model def default_get(self, fields): if self.env.context.get('default_applicant_id'): diff --git a/addons/hr_recruitment/models/hr_applicant.py b/addons/hr_recruitment/models/hr_applicant.py index 9b623282769..3201faab058 100644 --- a/addons/hr_recruitment/models/hr_applicant.py +++ b/addons/hr_recruitment/models/hr_applicant.py @@ -440,6 +440,7 @@ class Applicant(models.Model): 'default_user_id': self.env.uid, 'default_name': self.name, 'default_categ_ids': category and [category.id] or False, + 'attachment_ids': self.attachment_ids.ids } return res diff --git a/addons/hr_recruitment/models/hr_job.py b/addons/hr_recruitment/models/hr_job.py index 4bef7a16889..82826671d43 100644 --- a/addons/hr_recruitment/models/hr_job.py +++ b/addons/hr_recruitment/models/hr_job.py @@ -30,7 +30,7 @@ class Job(models.Model): address_id = fields.Many2one( 'res.partner', "Job Location", default=_default_address_id, domain=lambda self: self._address_id_domain(), - help="Address where employees are working") + help="Select the location where the applicant will work. Addresses listed here are defined on the company's contact information.") application_ids = fields.One2many('hr.applicant', 'job_id', "Job Applications") application_count = fields.Integer(compute='_compute_application_count', string="Application Count") all_application_count = fields.Integer(compute='_compute_all_application_count', string="All Application Count") @@ -44,9 +44,6 @@ class Job(models.Model): 'hr.employee', related='department_id.manager_id', string="Department Manager", readonly=True, store=True) user_id = fields.Many2one('res.users', "Recruiter", domain="[('share', '=', False), ('company_ids', 'in', company_id)]", tracking=True, help="The Recruiter will be the default value for all Applicants Recruiter's field in this job position. The Recruiter is automatically added to all meetings with the Applicant.") - hr_responsible_id = fields.Many2one( - 'res.users', "HR Responsible", tracking=True, - help="Person responsible of validating the employee's contracts.") document_ids = fields.One2many('ir.attachment', compute='_compute_document_ids', string="Documents", readonly=True) documents_count = fields.Integer(compute='_compute_document_ids', string="Document Count") alias_id = fields.Many2one(help="Email alias for this job position. New emails will automatically create new applicants for this job position.") diff --git a/addons/hr_recruitment/views/hr_applicant_views.xml b/addons/hr_recruitment/views/hr_applicant_views.xml index a93a27b0ccd..d38b90fa788 100644 --- a/addons/hr_recruitment/views/hr_applicant_views.xml +++ b/addons/hr_recruitment/views/hr_applicant_views.xml @@ -229,10 +229,15 @@ + + + + + @@ -263,10 +268,10 @@ + - - + diff --git a/addons/hr_recruitment_skills/views/hr_applicant_views.xml b/addons/hr_recruitment_skills/views/hr_applicant_views.xml index 0c6b9d9f8f9..20e87f50c2d 100644 --- a/addons/hr_recruitment_skills/views/hr_applicant_views.xml +++ b/addons/hr_recruitment_skills/views/hr_applicant_views.xml @@ -35,9 +35,6 @@ - - - diff --git a/addons/website_hr_recruitment/models/hr_job.py b/addons/website_hr_recruitment/models/hr_job.py index 71c4210b82a..8531ff87701 100644 --- a/addons/website_hr_recruitment/models/hr_job.py +++ b/addons/website_hr_recruitment/models/hr_job.py @@ -29,7 +29,7 @@ class Job(models.Model): default=_get_default_description, prefetch=False, sanitize_overridable=True, sanitize_attributes=False, sanitize_form=False) - website_published = fields.Boolean(help='Set if the application is published on the website of the company.') + website_published = fields.Boolean(help='Set if the application is published on the website of the company.', tracking=True) website_description = fields.Html( 'Website description', translate=html_translate, default=_get_default_website_description, prefetch=False, diff --git a/addons/website_hr_recruitment/views/hr_job_views.xml b/addons/website_hr_recruitment/views/hr_job_views.xml index a8cd23d71bf..da4c350922f 100644 --- a/addons/website_hr_recruitment/views/hr_job_views.xml +++ b/addons/website_hr_recruitment/views/hr_job_views.xml @@ -32,8 +32,8 @@ - diff --git a/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml b/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml index 21fe8539c8c..8fb17f2ad54 100644 --- a/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml +++ b/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml @@ -353,9 +353,9 @@