feature/odoo18 #2

Merged
administrator merged 43 commits from feature/odoo18 into develop 2025-05-22 16:16:43 +05:30
1 changed files with 19 additions and 0 deletions
Showing only changes of commit e8b25f005d - Show all commits

View File

@ -48,6 +48,25 @@ class HrCandidate(models.Model):
rec.resume_type = ''
rec.resume_name = ''
def _inverse_partner_email(self):
for candidate in self:
if not candidate.email_from:
continue
if not candidate.partner_id:
if not candidate.partner_name:
raise UserError(_('You must define a Contact Name for this candidate.'))
candidate.partner_id = self.env['res.partner'].sudo().with_context(default_lang=self.env.lang).find_or_create(candidate.email_from)
if candidate.partner_name and not candidate.sudo().partner_id.name:
candidate.sudo().partner_id.name = candidate.partner_name
if tools.email_normalize(candidate.email_from) != tools.email_normalize(candidate.sudo().partner_id.email):
# change email on a partner will trigger other heavy code, so avoid to change the email when
# it is the same. E.g. "email@example.com" vs "My Email" <email@example.com>""
candidate.sudo().partner_id.email = candidate.email_from
if candidate.partner_phone:
candidate.sudo().partner_id.phone = candidate.partner_phone
def action_open_applications(self):
self.ensure_one()
return {