diff --git a/addons/email_template/wizard/mail_compose_message.py b/addons/email_template/wizard/mail_compose_message.py index 168d93cdbe5..ad30b3817f5 100644 --- a/addons/email_template/wizard/mail_compose_message.py +++ b/addons/email_template/wizard/mail_compose_message.py @@ -68,7 +68,7 @@ class mail_compose_message(osv.TransientModel): values = self.pool.get('email.template').read(cr, uid, template_id, ['subject', 'body_html'], context) values.pop('id') elif template_id: - # FIXME odo: change the mail generation to avoid attachment duplication + # FIXME odo: change the mail generation to avoid attachment duplication values = self.generate_email_for_composer(cr, uid, template_id, res_id, context=context) # transform attachments into attachment_ids values['attachment_ids'] = [] @@ -142,12 +142,12 @@ class mail_compose_message(osv.TransientModel): return values def render_message(self, cr, uid, wizard, res_id, context=None): - """ Generate an email from the template for given (model, res_id) pair. - This method is meant to be inherited by email_template that will - produce a more complete dictionary, with email_to, ... - """ + """ Override to handle templates. """ # generate the composer email - values = self.generate_email_for_composer(cr, uid, wizard.template_id, res_id, context=context) + if wizard.template_id: + values = self.generate_email_for_composer(cr, uid, wizard.template_id, res_id, context=context) + else: + values = {} # get values to return email_dict = super(mail_compose_message, self).render_message(cr, uid, wizard, res_id, context) email_dict.update(values) diff --git a/addons/mail/wizard/mail_compose_message_view.xml b/addons/mail/wizard/mail_compose_message_view.xml index 57fc0aaf729..c0b329690e3 100644 --- a/addons/mail/wizard/mail_compose_message_view.xml +++ b/addons/mail/wizard/mail_compose_message_view.xml @@ -15,14 +15,17 @@