[FIX] mail.compose.message: fixed rendering when no template is chosen in the selection box; also cleaned display of recipients when using the wizard in mass mailing mode.

bzr revid: tde@openerp.com-20121211155435-l5s9lpghpxw8bi9o
This commit is contained in:
Thibault Delavallée
2012-12-11 16:54:35 +01:00
parent 3a1e0059a2
commit 0237833240
2 changed files with 11 additions and 8 deletions
@@ -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)
@@ -15,14 +15,17 @@
<!-- visible wizard -->
<label for="partner_ids" string="Recipients"/>
<div>
<span attrs="{'invisible':[('model', '=', False)]}">
<span attrs="{'invisible':['|', ('model', '=', False), ('composition_mode', '!=', 'mass_mail')]}">
Followers of selected items and
</span>
<span attrs="{'invisible':['|', ('model', '=', False), ('composition_mode', '=', 'mass_mail')]}">
Followers of
<field name="record_name" readonly="1" class="oe_inline"
attrs="{'invisible':[('model', '=', False)]}"/>
and
</span>
<field name="partner_ids" widget="many2many_tags_email" placeholder="Add contacts to notify..."
context="{'force_email':True}" required="1"/>
context="{'force_email':True}"/>
</div>
<field name="subject" placeholder="Subject..."/>
</group>