<?xml version='1.0' encoding='utf-8'?>
<odoo>

    <record id="mailing_mailing_view_tree_odex25_marketing_automation" model="ir.ui.view" >
        <field name="name">mailing.mailing.view.tree.marketing.automation</field>
        <field name="model">mailing.mailing</field>
        <field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_tree"/>
        <field name="mode">primary</field>
        <field name="priority">20</field>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='subject']" position="after">
                <field name="marketing_activity_ids" string="Activities" widget="many2many_tags"/>
            </xpath>
            <xpath expr="//field[@name='state']" position="attributes">
                <attribute name="invisible">1</attribute>
            </xpath>
        </field>
    </record>

    <record id="mailing_mailing_view_form_odex25_marketing_automation" model="ir.ui.view" >
        <field name="name">mailing.mailing.view.form.marketing.automation</field>
        <field name="model">mailing.mailing</field>
        <field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_form"/>
        <field name="mode">primary</field>
        <field name="priority">20</field>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='subject']" position="attributes">
                <attribute name="attrs">{}</attribute>
            </xpath>
            <xpath expr="//field[@name='preview']" position="attributes">
                <attribute name="attrs">{'readonly': [('mailing_type', '!=', 'mail')], 'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
            </xpath>
            <xpath expr="//page[@name='mail_body']" position="replace">
                <page string="Mail Body" name="mail_body">
                    <field name="body_html" class="oe_read_only" widget="html" options="{
                        'cssReadonly': 'mass_mailing.iframe_css_assets_readonly',
                    }"/>
                    <field name="body_arch" class="oe_edit_only" widget="mass_mailing_html" options="{
                        'snippets': 'mass_mailing.email_designer_snippets',
                        'cssEdit': 'mass_mailing.iframe_css_assets_edit',
                        'inline-field': 'body_html'
                    }"/>
                </page>
            </xpath>
            <xpath expr="//field[@name='state']" position="attributes">
                <attribute name="invisible">1</attribute>
            </xpath>
            <xpath expr="//button[@name='action_put_in_queue']" position="replace"/>
            <xpath expr="//button[@name='action_schedule']" position="replace"/>
            <field name="mailing_domain" position="replace"/>
            <xpath expr="//label[@for='mailing_model_id']" position="attributes">
                <attribute name="invisible">1</attribute>
            </xpath>
            <xpath expr="//div[@name='mailing_model_id_container']" position="attributes">
                <attribute name="invisible">1</attribute>
            </xpath>
            <xpath expr="//label[@for='contact_list_ids']" position="replace"/>
            <xpath expr="//field[@name='contact_list_ids']" position="replace"/>
            <xpath expr="//field[@name='medium_id']" position="after">
                <field name="marketing_activity_ids" string="Activities" widget="many2many_tags"/>
            </xpath>
        </field>
    </record>

    <record id="mailing_mailing_view_form_marketing_activity" model="ir.ui.view">
        <field name="name">mailing.mailing.view.form.marketing.activity</field>
        <field name="model">mailing.mailing</field>
        <field name="priority">20</field>
        <field name="arch" type="xml">
        <form string="Mail Template">
            <sheet>
                <group>
                    <field name="subject"/>
                    <field name="email_from"/>
                    <field name="mailing_type" invisible="1"/>
                    <label for="mailing_model_id" string="Participants" invisible="1"/>
                    <field name="mailing_model_id" invisible="1"/>
                    <field name="mailing_model_real" invisible="1"/>
                    <field name="use_in_odex25_marketing_automation" invisible="1"/>
                    <field name="campaign_id" invisible="1"/>
                    <field name="state" invisible="1"/>
                </group>
                <notebook>
                    <page string="Mail Body" name="mail_body">
                        <field name="body_html" class="oe_read_only" widget="html" options="{
                            'cssReadonly': 'mass_mailing.iframe_css_assets_readonly',
                        }"/>
                        <field name="body_arch" class="oe_edit_only" widget="mass_mailing_html" options="{
                            'snippets': 'mass_mailing.email_designer_snippets',
                            'cssEdit': 'mass_mailing.iframe_css_assets_edit',
                            'inline-field': 'body_html'
                        }"/>
                    </page>
                    <page string="Options" name="options">
                        <group>
                            <group string="Mailing" name="group_mailing">
                                <field name="attachment_ids" widget="many2many_binary" string="Attach a file" class="oe_inline"/>
                                <field name="keep_archives" groups="base.group_no_one"/>
                                <label for="reply_to"/>
                                <div>
                                    <field name="reply_to_mode" widget="radio" attrs="{'invisible': [('mailing_model_real', '=', 'mailing.contact')]}"/>
                                    <field name="reply_to" attrs="{'required': [('reply_to_mode', '=', 'email')], 'invisible': [('reply_to_mode', '!=', 'email')]}"/>
                                </div>
                            </group>
                        </group>
                    </page>
                </notebook>
            </sheet>
            <div class="oe_chatter">
                <field name="message_follower_ids" groups="base.group_user"/>
                <field name="message_ids"/>
                <field name="activity_ids"/>
            </div>
        </form>
        </field>
    </record>

    <record id="mass_mailing.mailing_mailing_action_mail" model="ir.actions.act_window">
        <field name="domain">['&amp;', ('mailing_type', '=', 'mail'), ('use_in_odex25_marketing_automation', '=', False)]</field>
    </record>

    <record id="mail_mass_mailing_action_odex25_marketing_automation" model="ir.actions.act_window">
        <field name="name">Marketing Automation Mailings</field>
        <field name="res_model">mailing.mailing</field>
        <field name="view_mode">tree,form,graph</field>
        <field name="domain">[('use_in_odex25_marketing_automation', '=', True)]</field>
    </record>
    <record id="mail_mass_mailing_action_odex25_marketing_automation_tree" model="ir.actions.act_window.view">
        <field name="sequence">1</field>
        <field name="view_mode">tree</field>
        <field name="act_window_id" ref="mail_mass_mailing_action_odex25_marketing_automation"/>
        <field name="view_id" ref="mailing_mailing_view_tree_odex25_marketing_automation"/>
    </record>
    <record id="mail_mass_mailing_action_odex25_marketing_automation_form" model="ir.actions.act_window.view">
        <field name="sequence">2</field>
        <field name="view_mode">form</field>
        <field name="act_window_id" ref="mail_mass_mailing_action_odex25_marketing_automation"/>
        <field name="view_id" ref="mailing_mailing_view_form_odex25_marketing_automation"/>
    </record>

</odoo>
