From e8290470154881cf7f77aedda353048fa4acd0af Mon Sep 17 00:00:00 2001 From: Richard Mathot Date: Mon, 20 Oct 2014 17:35:33 +0200 Subject: [PATCH] [FIX] (website_)hr_recruitment: correct version of 659db669aae1ae58f2b416e3681b66269ed7521d --- addons/hr_recruitment/hr_recruitment.py | 7 ------- addons/website_hr_recruitment/controllers/main.py | 11 ++++++++--- 2 files changed, 8 insertions(+), 10 deletions(-) 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", {})