summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2012-08-31 18:39:04 +0200
committerOlivier Dony <odo@openerp.com>2012-08-31 18:39:04 +0200
commitfb7491ed709c159da9e5337c0a2bd6b1187cfffc (patch)
tree5299f3dbc6d66895d7bfe7f2bc78df678d44b8a1 /addons
parent04c6823a99442d34fe1c4f2ca9be12bbb0cbbdb3 (diff)
[FIX] email_template: fix template views + preview after latest model changes
bzr revid: odo@openerp.com-20120831163904-jh76tko9hwd2a06y
Diffstat (limited to 'addons')
-rw-r--r--addons/email_template/email_template_view.xml1
-rw-r--r--addons/email_template/wizard/email_template_preview.py8
-rw-r--r--addons/email_template/wizard/email_template_preview_view.xml21
3 files changed, 10 insertions, 20 deletions
diff --git a/addons/email_template/email_template_view.xml b/addons/email_template/email_template_view.xml
index cd75a719197..15164c22752 100644
--- a/addons/email_template/email_template_view.xml
+++ b/addons/email_template/email_template_view.xml
@@ -67,7 +67,6 @@
<separator string="Advanced Options" colspan="2"/>
<field name="mail_server_id"/>
<field name="track_campaign_item"/>
- <field name="message_id"/>
<field name="auto_delete"/>
<field name="lang"/>
</group>
diff --git a/addons/email_template/wizard/email_template_preview.py b/addons/email_template/wizard/email_template_preview.py
index 2c1866a53c4..d1a398cf3e6 100644
--- a/addons/email_template/wizard/email_template_preview.py
+++ b/addons/email_template/wizard/email_template_preview.py
@@ -74,19 +74,19 @@ class email_template_preview(osv.osv_memory):
vals = {}
email_template = self.pool.get('email.template')
template_id = context and context.get('template_id')
+
+ # FIXME ODO: replace everything below with a call to template.generate_email
template = email_template.get_email_template(cr, uid, template_id=template_id, record_id=res_id, context=context)
model = template.model
vals['email_to'] = self.render_template(cr, uid, template.email_to, model, res_id, context)
vals['email_cc'] = self.render_template(cr, uid, template.email_cc, model, res_id, context)
vals['reply_to'] = self.render_template(cr, uid, template.reply_to, model, res_id, context)
vals['subject'] = self.render_template(cr, uid, template.subject, model, res_id, context)
- description = self.render_template(cr, uid, template.body, model, res_id, context) or ''
+ description = self.render_template(cr, uid, template.body_html, model, res_id, context) or ''
if template.user_signature:
signature = self.pool.get('res.users').browse(cr, uid, uid, context).signature
description += '\n' + signature
- vals['body'] = description
- if template.body_html:
- vals['body_html'] = self.render_template(cr, uid, template.body_html, model, res_id, context) or ''
+ vals['body_html'] = description
vals['report_name'] = self.render_template(cr, uid, template.report_name, model, res_id, context)
return {'value': vals}
diff --git a/addons/email_template/wizard/email_template_preview_view.xml b/addons/email_template/wizard/email_template_preview_view.xml
index 708ca2b0406..e621ec446ff 100644
--- a/addons/email_template/wizard/email_template_preview_view.xml
+++ b/addons/email_template/wizard/email_template_preview_view.xml
@@ -6,26 +6,17 @@
<field name="name">email_template.preview.form</field>
<field name="model">email_template.preview</field>
<field name="arch" type="xml">
- <form string="Email Preview">
- <field name="model_id" invisible="1"/>
- <field name="res_id" on_change="on_change_res_id(res_id, context)"/>
- <group col="2" colspan="4">
+ <form string="Email Preview" version="7.0">
+ <group>
+ <field name="model_id" invisible="1"/>
+ <field name="res_id" on_change="on_change_res_id(res_id, context)"/>
<field name="email_to" readonly="1"/>
<field name="email_cc" readonly="1" attrs="{'invisible': [('email_cc','=',False)]}"/>
<field name="reply_to" readonly="1" attrs="{'invisible': [('reply_to','=',False)]}"/>
<field name="subject" readonly="1"/>
+ <field name="body_html" nolabel="1" colspan="4" height="350" width="350" readonly="1" widget="html"/>
+ <field name="report_name" colspan="4" readonly="1"/>
</group>
- <group col="4" colspan="4">
- <notebook>
- <page string="Body (Text)">
- <field name="body" nolabel="1" colspan="4" height="350" width="350" readonly="1"/>
- </page>
- <page string="Body (Rich/HTML)" attrs="{'invisible': [('body_html','=', False)]}">
- <field name="body_html" nolabel="1" colspan="4" height="350" width="350" readonly="1"/>
- </page>
- </notebook>
- </group>
- <field name="report_name" colspan="4" readonly="1"/>
</form>
</field>
</record>