[FIX] email_template: fix template views + preview after latest model changes
bzr revid: odo@openerp.com-20120831163904-jh76tko9hwd2a06y
This commit is contained in:
parent
04c6823a99
commit
fb7491ed70
|
@ -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>
|
||||
|
|
|
@ -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}
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue