From ccfdca99fb7dd6947e8b31d79c71d2bb8aae9aa4 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 24 Mar 2015 15:08:43 +0100 Subject: [PATCH] [FIX] hr_recruitment: missing attachments in email template When switching an applicant to another stage, there is the possibility to send an email template, according to the given stage. The attachments defined in the email templates should be sent as well. opw-630768 --- addons/hr_recruitment/hr_recruitment.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index ec564bcbaee..6721002e228 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -468,12 +468,13 @@ class hr_applicant(osv.Model): 'post': True, 'notify': True, }, context=compose_ctx) + values = self.pool['mail.compose.message'].onchange_template_id( + cr, uid, [compose_id], stage.template_id.id, 'mass_mail', self._name, False, context=compose_ctx)['value'] + if values.get('attachment_ids'): + values['attachment_ids'] = [(6, 0, values['attachment_ids'])] self.pool['mail.compose.message'].write( cr, uid, [compose_id], - self.pool['mail.compose.message'].onchange_template_id( - cr, uid, [compose_id], - stage.template_id.id, 'mass_mail', self._name, False, - context=compose_ctx)['value'], + values, context=compose_ctx) self.pool['mail.compose.message'].send_mail(cr, uid, [compose_id], context=compose_ctx) return res