<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <record id="mail_template_preview_view_form" model="ir.ui.view">
            <field name="name">mail.template.preview.view.form</field>
            <field name="model">mail.template.preview</field>
            <field name="arch" type="xml">
                <form string="Email Preview">
                    <sheet>
                        <div class="oe_title">
                            <h3>Preview of <field name="mail_template_id" readonly="1" nolabel="1" options="{'no_open': True}"/></h3>
                        </div>
                        <div class="alert alert-danger" role="alert" invisible="not error_msg">
                            <field name="error_msg" widget="text"/>
                        </div>
                        <field name="no_record" invisible="1"/>

                        <group>
                            <label for="resource_ref" string="Test Record: "/>
                            <field name="resource_ref" nolabel="1"
                                   options="{'hide_model': True, 'no_create': True, 'no_open': True}"
                                   readonly="False"
                                   invisible="no_record"/>
                            <b invisible="not no_record" class="text-warning">No record for this model</b>

                            <field name="lang" string="Force a Language:" placeholder="Select a language"/>

                            <field name="subject"/>
                            <field name="email_from" invisible="not email_from"/>
                            <field name="partner_ids" widget="many2many_tags" invisible="not partner_ids"/>
                            <field name="email_to" invisible="not email_to"/>
                            <field name="email_cc" invisible="not email_cc"/>
                            <field name="reply_to" invisible="not reply_to"/>
                            <field name="scheduled_date" invisible="not scheduled_date"/>

                            <field name="body_html" widget="html" colspan="2" nolabel="1" options="{'safe': True}"/>
                            <field name="attachment_ids" widget="many2many_binary"/>
                        </group>
                    </sheet>
                    <footer>
                        <button string="Close" class="btn-secondary" special="cancel" data-hotkey="x"/>
                    </footer>
                </form>
            </field>
        </record>

        <record id="mail_template_preview_action" model="ir.actions.act_window">
            <field name="name">Template Preview</field>
            <field name="res_model">mail.template.preview</field>
            <field name="binding_model_id" eval="False"/>
            <field name="view_mode">form</field>
            <field name="view_id" ref="mail_template_preview_view_form"/>
            <field name="target">new</field>
            <field name="context">{'default_mail_template_id':active_id}</field>
        </record>

    </data>
</odoo>
