summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2012-01-25 18:34:03 +0100
committerOlivier Dony <odo@openerp.com>2012-01-25 18:34:03 +0100
commitf0fdfc450cba3d994ee511f24f2149e5dbbdd30f (patch)
tree657637f54adc2010c9016d23a59a02b29ecaa3ab
parent82e7f91b5dea422c812db2a7c6199698e090777d (diff)
parentdde2a5766fa490699bbf3d3dc462d61aaec29037 (diff)
[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
-rw-r--r--addons/email_template/email_template.py2
-rw-r--r--addons/email_template/wizard/mail_compose_message.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py
index 90eda625759..fe4155cb236 100644
--- a/addons/email_template/email_template.py
+++ b/addons/email_template/email_template.py
@@ -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',
diff --git a/addons/email_template/wizard/mail_compose_message.py b/addons/email_template/wizard/mail_compose_message.py
index beb59ba1eea..ef4572429a1 100644
--- a/addons/email_template/wizard/mail_compose_message.py
+++ b/addons/email_template/wizard/mail_compose_message.py
@@ -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: