def case_cancel_mail(self, cr, uid, ids, context=None): """Overrides cancel for hr_applicant for sending email """ assert len(ids) == 1, 'This option should only be used for a single id at a time.' ir_model_data = self.pool.get('ir.model.data') if context==None: context={} try: template_id = ir_model_data.get_object_reference(cr, uid, 'module_name', 'email_template_name')[1] template_obj=self.pool.get('email.template').browse (cr,uid,template_id,context) except ValueError: template_id = False template_obj=self.pool.get('email.template').browse (cr,uid,template_id,context) applicant_obj=self.pool.get('hr.applicant').browse (cr,uid,ids,context)[0] email_to=applicant_obj.email_from values={ 'email_from': template_obj.email_from, 'subject':template_obj.subject, 'body_html':template_obj.body_html, 'email_to': email_to, 'email_cc':template_obj.email_cc, 'reply_to':template_obj.reply_to, 'state':'outgoing', 'mail_server_id':template_obj.mail_server_id.id or False, 'auto_delete':template_obj.auto_delete, } if values['body_html']: values['body'] = tools.html_sanitize(values['body_html']) msg_id=self.pool.get('mail.mail').create(cr,uid,values,context) res=self.case_cancel(cr, uid, ids, context) # close applicant return True