[MERGE] email_template: correctly pass template id via context

This fixes the sidebar action buttons that
are supposed to open a given template, but
actually opened an empty form

lp bug: https://launchpad.net/bugs/915372 fixed
lp bug: https://launchpad.net/bugs/886144 fixed

bzr revid: odo@openerp.com-20120125173403-dit8zp3ggalajdhq
This commit is contained in:
Olivier Dony 2012-01-25 18:34:03 +01:00
commit f0fdfc450c
2 changed files with 5 additions and 1 deletions

View File

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

View File

@ -69,6 +69,10 @@ class mail_compose_message(osv.osv_memory):
size=-1 # means we want an int db column
),
}
_defaults = {
'template_id' : lambda self, cr, uid, context={} : context.get('mail.compose.template_id', False)
}
def on_change_template(self, cr, uid, ids, use_template, template_id, email_from=None, email_to=None, context=None):
if context is None: