diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index fc85786ac63..a265965896e 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -422,13 +422,6 @@ class hr_applicant(osv.Model): cr, uid, [applicant.job_id.id], body=_('New application from %s') % name, subtype="hr_recruitment.mt_job_applicant_new", context=context) - self.message_post( - cr, uid, [applicant.id], - body = _("%s's Application \n From: %s \n\n %s \n") % (name, vals.get('email_from') or "", vals.get('description',"") or ""), - attachments = context.get('attachments'), - content_subtype = 'plaintext', - subtype = "hr_recruitment.mt_applicant_hired", - context = context) return obj_id def write(self, cr, uid, ids, vals, context=None): diff --git a/addons/website_hr_recruitment/controllers/main.py b/addons/website_hr_recruitment/controllers/main.py index 2f5c20b0cab..45af62d6dc2 100644 --- a/addons/website_hr_recruitment/controllers/main.py +++ b/addons/website_hr_recruitment/controllers/main.py @@ -117,9 +117,14 @@ class website_hr_recruitment(http.Controller): # Retro-compatibility for saas-3. "phone" field should be replace by "partner_phone" in the template in trunk. value['partner_phone'] = post.pop('phone', False) - attachment = [] + applicant = env['hr.applicant'].create(value) if post['ufile']: - attachment.append((post['ufile'].filename, post['ufile'].read())) - env['hr.applicant'].with_context(attachments = attachment).create(value) + name = applicant.partner_name if applicant.partner_name else applicant.name + applicant.message_post( + body = _("%s's Application \n From: %s \n\n %s \n") % (name, applicant.email_from or "", applicant.description or ""), + attachments = [(post['ufile'].filename, post['ufile'].read())], + content_subtype = 'plaintext', + subtype = "hr_recruitment.mt_applicant_hired") + return request.render("website_hr_recruitment.thankyou", {})