[FIX] Fixed fix of revision 7750. Correct fix was to add in the generated action an use_template context key, that triggers the use of templates. Eveything is then managed inside the email_template override of mail.compose.message.

bzr revid: tde@openerp.com-20121016115839-8cj0u9si20qo14av
This commit is contained in:
Thibault Delavallée 2012-10-16 13:58:39 +02:00
parent e915bd83cb
commit c3aecf0630
3 changed files with 3 additions and 6 deletions

View File

@ -175,7 +175,7 @@ class email_template(osv.osv):
'res_model': 'mail.compose.message',
'src_model': src_obj,
'view_type': 'form',
'context': "{'default_composition_mode': 'mass_mail', 'default_template_id' : %d}" % (template.id),
'context': "{'default_composition_mode': 'mass_mail', 'default_template_id' : %d, 'default_use_template': True}" % (template.id),
'view_mode':'form,tree',
'view_id': res_id,
'target': 'new',

View File

@ -25,6 +25,7 @@ openerp.mail = function(session) {
*/
for(var key in action.context){
if( key!='default_template_id' &&
key!='default_composition_mode' &&
key!='default_use_template' &&
key!='default_is_private' &&
key!='default_model' &&

View File

@ -81,11 +81,7 @@ class mail_compose_message(osv.TransientModel):
elif composition_mode == 'comment' and model and res_id:
vals = self.get_record_data(cr, uid, model, res_id, context=context)
elif composition_mode == 'mass_mail' and model and active_ids:
if context.get('default_template_id'):
vals = self.pool.get('email.template').generate_email(cr, uid, context.get('default_template_id'), res_id, context=context)
vals.update({'content_subtype': 'html'})
else:
vals = {'model': model, 'res_id': res_id, 'content_subtype': 'html'}
vals = {'model': model, 'res_id': res_id, 'content_subtype': 'html'}
else:
vals = {'model': model, 'res_id': res_id}
if composition_mode: