[FIX] website_hr_recruitement: Mail not send at creation

When an applicant is created from the website
and the job_id has a first stage with a template to send
the mail is actually not sent.

This is happening because at the creation of
a mail.thread values from computed field don't
appear in the change to track.
so _message_track_post_template don't see the
change on stage_id and thus don't send the email

This is going to be fix on the master
in the meanwhile we can force the value of the stage_id
at the creation of the applicant from the website form

closes odoo/odoo#53462

X-original-commit: bbaf4913382809da0c4d644f914cb3e8191a5d1b
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Thibault Francois
2020-06-22 17:15:24 +00:00
parent 61a3a4d52d
commit 3ad85b6f06
@@ -32,6 +32,13 @@ class Applicant(models.Model):
def website_form_input_filter(self, request, values):
if 'partner_name' in values:
values.setdefault('name', '%s\'s Application' % values['partner_name'])
if values.get('job_id'):
stage = self.env['hr.recruitment.stage'].sudo().search([
('fold', '=', False),
'|', ('job_ids', '=', False), ('job_ids', '=', values['job_id']),
], order='sequence asc', limit=1)
if stage:
values['stage_id'] = stage.id
return values