[FIX] hr_recruitment: synchronize if partner_id changes

Complement to commits:
290465e57dfcb8503e382a418e0ba4498ea5693b
72c62dbf157dfb353caf13a228921e3f81036885

Prevent synchronization between applicant
and partner if partner information changes.
The partner must be changed to update the applicant.

When someone applies for a job via a platform,
the "generic" email is used to create the applicant.
As a result, all applicants have the same partner.
The different commits and this one ensure that
the partner's email is not overwritten
if we update the applicant's email address.
Because changing the partner's email address
synchronized it with all applicants.
All applicants had the same e-mail address.

opw-3166630

closes odoo/odoo#129277

X-original-commit: 397e5ee79b46631040eb71c89b1f7e2891a3da52
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
This commit is contained in:
Thomas Lefebvre (thle)
2023-07-24 10:14:36 +02:00
parent 93b2efc33e
commit 9f1dd660cb
+5 -4
View File
@@ -251,12 +251,13 @@ class Applicant(models.Model):
for applicant in self:
applicant.user_id = applicant.job_id.user_id.id or self.env.uid
@api.depends('partner_id', 'partner_id.email', 'partner_id.mobile', 'partner_id.phone')
@api.depends('partner_id')
def _compute_partner_phone_email(self):
for applicant in self:
applicant.partner_phone = applicant.partner_id.phone
applicant.partner_mobile = applicant.partner_id.mobile
applicant.email_from = applicant.partner_id.email
if applicant.partner_id:
applicant.partner_phone = applicant.partner_id.phone
applicant.partner_mobile = applicant.partner_id.mobile
applicant.email_from = applicant.partner_id.email
def _inverse_partner_email(self):
for applicant in self.filtered(lambda a: a.partner_id and a.email_from and not a.partner_id.email):