<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data>

<record model="ir.ui.view" id="view_mail_mass_mailing_sending_tree">
    <field name="name">mail.mass_mailing.sending.tree</field>
    <field name="model">mail.mass_mailing.sending</field>
    <field name="arch" type="xml">
        <tree string="Mass mailing sendings">
            <field name="mass_mailing_id"/>
            <field name="date_start"/>
            <field name="state"/>
            <field name="pending_count"/>
            <field name="sending_count"/>
            <field name="sent_count"/>
            <field name="failed_count"/>
        </tree>
    </field>
</record>

<record model="ir.ui.view" id="view_mail_mass_mailing_sending_form">
    <field name="name">mail.mass_mailing.sending.form</field>
    <field name="model">mail.mass_mailing.sending</field>
    <field name="arch" type="xml">
        <form string="Mass mailing sending">
            <group>
                <group>
                    <field name="mass_mailing_id"/>
                    <field name="state"/>
                    <field name="date_start"/>
                    <field name="date_end"/>
                </group>
                <group>
                    <field name="pending_count"/>
                    <field name="sending_count"/>
                    <field name="sent_count"/>
                    <field name="failed_count"/>
                </group>
            </group>
            <group attrs="{'invisible': [('error', '=', False)]}">
                <field name="error"/>
            </group>
        </form>
    </field>
</record>

<record model="ir.ui.view" id="view_mail_mass_mailing_sending_search">
    <field name="name">mail.mass_mailing.sending.search</field>
    <field name="model">mail.mass_mailing.sending</field>
    <field name="arch" type="xml">
       <search string="Mass mailing sending">
            <field name="mass_mailing_id"/>
            <filter string="Enqueued" name="enqueued" domain="[('state', '=', 'enqueued')]"/>
            <filter string="Sending" name="sending" domain="[('state', '=', 'sending')]"/>
            <filter string="Running" name="running" domain="[('state', '!=', 'sent')]"/>
            <filter string="Sent" name="sent" domain="[('state', '=' ,'sent')]"/>
            <group expand="0" string="Group By">
                <filter string="Mass mailing" name="group_mass_mailing" context="{'group_by': 'mass_mailing_id'}"/>
            </group>
        </search>
    </field>
</record>

<record id="action_view_mail_mass_mailing_sending" model="ir.actions.act_window">
    <field name="name">Mass mailing sendings</field>
    <field name="res_model">mail.mass_mailing.sending</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form</field>
    <field name="context">{'search_default_running': 1}</field>
    <field name="search_view_id" ref="view_mail_mass_mailing_sending_search"/>
</record>

<menuitem name="Mass mailing sending" id="menu_mass_mailing_sending"
    parent="base.menu_email" sequence="60"
    action="action_view_mail_mass_mailing_sending"/>

</data>
</openerp>
