From 3ad85b6f06d4924d08bcfaf55b3694eaf8fbc7f1 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Fri, 19 Jun 2020 12:45:31 +0000 Subject: [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) --- addons/website_hr_recruitment/models/hr_recruitment.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/website_hr_recruitment/models/hr_recruitment.py b/addons/website_hr_recruitment/models/hr_recruitment.py index b4a1e6acbc2..bcd8fc5a874 100644 --- a/addons/website_hr_recruitment/models/hr_recruitment.py +++ b/addons/website_hr_recruitment/models/hr_recruitment.py @@ -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 -- cgit v1.2.3