Skip to content
Snippets Groups Projects
mail_template_views.xml 2.36 KiB
<?xml version="1.0" encoding="utf-8"?>
<odoo>
        <!-- Form view -->
        <record id="view_email_template_form" model="ir.ui.view">
            <field name="name">view_email_template_form</field>
            <field name="model">mail.template</field>
            <field name="inherit_id" ref="mail.email_template_form"/>
            <field name="arch" type="xml">

                <field name="model_id" position="after">
                    <field name="is_redner_template"/>
                </field>

                <!-- Hide HTML contents, superseded by the body produced by redner. -->
                <xpath expr="//field[@name='body_html']" position="attributes">
                    <attribute name="attrs">{'invisible': [('is_redner_template', '=', True)]}</attribute>
                </xpath>

                <!-- Hide the single attachment selector too, not supported with redner. -->
                <xpath expr="//field[@name='attachment_ids']" position="attributes">
                    <attribute name="attrs">{'invisible': [('is_redner_template', '=', True)]}</attribute>
                </xpath>

                <!-- Add redner fields instead of the above. -->
                <xpath expr="//field[@name='body_html']" position="before">

                    <group string="Rednerd Template"
                        attrs="{'invisible': [('is_redner_template', '=', False)]}">
                        <field name="redner_tmpl_id"
                            attrs="{'required': [('is_redner_template', '=', True)]}" />
                    </group>

                    <button name="action_get_substitutions" type="object"
                        string="Get Substitutions from Rednerd Template"
                        attrs="{'invisible': [('is_redner_template', '=', False)]}" />

                    <group string="Substitutions"
                        attrs="{'invisible': [('is_redner_template', '=', False)]}">
                        <field name="redner_substitution_ids" nolabel="1">
                            <tree editable="top">
                                <field name="keyword" />
                                <field name="converter" />
                                <field name="value" />
                            </tree>
                        </field>
                    </group>

                </xpath>

            </field>
        </record>

</odoo>