From 71b9933411f7370af43fa3437ea72c031aaa81f8 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Tue, 6 Jun 2023 11:38:50 +0200 Subject: [PATCH] [IMP] hr_recruitment: Avoid partner duplication Use the application form partner as work contact when converting him into and employee. Use the employee work contact as user partner on user creation. The goal is to have only 1 partner over the whole recruitment process flow, instead of three, thus reducing the confusion for end users who don't really know who to choose. TaskID: 3101400 --- addons/hr/models/hr_employee.py | 1 + addons/hr_recruitment/models/hr_applicant.py | 1 + 2 files changed, 2 insertions(+) diff --git a/addons/hr/models/hr_employee.py b/addons/hr/models/hr_employee.py index b565b7dfa36..4e76354f902 100644 --- a/addons/hr/models/hr_employee.py +++ b/addons/hr/models/hr_employee.py @@ -193,6 +193,7 @@ class HrEmployeePrivate(models.Model): 'default_phone': self.work_phone, 'default_mobile': self.mobile_phone, 'default_login': self.work_email, + 'default_partner_id': self.work_contact_id.id, }) } diff --git a/addons/hr_recruitment/models/hr_applicant.py b/addons/hr_recruitment/models/hr_applicant.py index 24aa1c603b6..7378ba76b7e 100644 --- a/addons/hr_recruitment/models/hr_applicant.py +++ b/addons/hr_recruitment/models/hr_applicant.py @@ -586,6 +586,7 @@ class Applicant(models.Model): address_sudo = self.env['res.partner'].sudo().browse(address_id) return { 'name': self.partner_name or self.partner_id.display_name, + 'work_contact_id': self.partner_id.id, 'job_id': self.job_id.id, 'job_title': self.job_id.name, 'private_street': address_sudo.street,