From eefbb2ac5c668f9c52bf8213824911e2d2288782 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 9 Mar 2012 02:11:56 +0100 Subject: [PATCH] [FIX] email_template: care for missing context bzr revid: odo@openerp.com-20120309011156-q53pc4h6stlz3kq2 --- addons/email_template/email_template.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 6c1571c5630..e76000ae83a 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -374,6 +374,7 @@ class email_template(osv.osv): was executed for this message only. :returns: id of the mail.message that was created """ + if context is None: context = {} mail_message = self.pool.get('mail.message') ir_attachment = self.pool.get('ir.attachment') values = self.generate_email(cr, uid, template_id, res_id, context=context) @@ -390,8 +391,7 @@ class email_template(osv.osv): 'res_model': mail_message._name, 'res_id': msg_id, } - if context.has_key('default_type'): - del context['default_type'] + context.pop('default_type', None) attachment_ids.append(ir_attachment.create(cr, uid, attachment_data, context=context)) if force_send: mail_message.send(cr, uid, [msg_id], context=context)