<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 Tecnativa - Jairo Llopis
     License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

    <record id="mailing_list_view_form" model="ir.ui.view">
        <field name="name">Add sync stuff</field>
        <field name="model">mailing.list</field>
        <field name="inherit_id" ref="mass_mailing.mailing_list_view_form" />
        <field name="arch" type="xml">
            <xpath expr="//div[hasclass('oe_title')]" position="after">
                <group name="dynamic" string="Dynamic list">
                    <group colspan="4">
                        <field name="dynamic" />
                        <field name="is_synced" invisible="1" />
                    </group>
                    <group attrs="{'invisible': [('dynamic', '=', False)]}">
                        <label for="sync_method" />
                        <div>
                            <field name="sync_method" />
                            <button
                                name="action_sync"
                                type="object"
                                string="Sync now"
                                icon="fa-exclamation-triangle"
                                class="btn-danger"
                                attrs="{'invisible': [('is_synced', '=', True)]}"
                            />
                            <button
                                name="action_sync"
                                type="object"
                                string="Sync now"
                                icon="fa-refresh"
                                attrs="{'invisible': [('is_synced', '=', False)]}"
                            />
                        </div>
                    </group>
                    <div attrs="{'invisible': [('dynamic', '=', False)]}">
                        <div class="alert alert-info" role="alert">
                            <i
                                class="fa fa-info-circle"
                            /> If you want to remove contacts from a dynamic list, just <b
                            >set them as <i>Opt Out</i></b>.
                        </div>
                        <div class="alert alert-warning" role="alert">
                            <i
                                class="fa fa-info-circle"
                            /> You cannot make manual editions of contacts in fully synchronized lists.
                        </div>
                    </div>
                    <group colspan="4" attrs="{'invisible': [('dynamic', '=', False)]}">
                        <field
                            name="sync_domain"
                            widget="domain"
                            options='{"model": "res.partner"}'
                        />
                    </group>
                    <button
                        name="%(action_mailing_load_filter)d"
                        type="action"
                        string="Load filter"
                        icon="fa-filter"
                        colspan="1"
                    />
                </group>
            </xpath>
            <field name="contact_count" position="attributes">
                <attribute name="attrs">
                    {'invisible': [('is_synced', '=', False)]}
                </attribute>
            </field>
            <field name="contact_count" position="after">
                <span attrs="{'invisible': [('is_synced', '=', True)]}">
                    <strong>???</strong>
                </span>
            </field>
        </field>
    </record>

</odoo>
