<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

        <record id="view_mail_statistics_report_graph" model="ir.ui.view">
            <field name="name">mail.statistics.report.graph</field>
            <field name="model">mail.statistics.report</field>
            <field name="arch" type="xml">
                <graph string="Mass Mailing Statistics" type="pivot" stacked="True">
                    <field name="campaign" type="row"/>
                    <field name="sent" type="measure"/>
                    <field name="delivered" type="measure"/>
                    <field name="opened" type="measure"/>
                    <field name="bounced" type="measure"/>
                    <field name="replied" type="measure"/>
                </graph>
            </field>
        </record>

        <record id="view_mail_statistics_report_search" model="ir.ui.view">
            <field name="name">mail.statistics.report.search</field>
            <field name="model">mail.statistics.report</field>
            <field name="arch" type="xml">
                <search string="Mass Mailing Statistics">
                    <group expand="0" string="Extended Filters...">
                        <field name="scheduled_date"/>
                    </group>
                    <group expand="1" string="Group By...">
                        <filter string="Mass Mailing Campaign"
                            domain="[]" context="{'group_by':'campaign'}"/>
                        <filter string="State" domain="[]"
                            context="{'group_by':'state'}"/>
                        <filter string="Sent By" domain="[]"
                            context="{'group_by':'email_from'}"/>
                        <separator/>
                        <filter string="Scheduled Month"
                            domain="[]" context="{'group_by':'scheduled_date:month'}"/>
                    </group>
                </search>
            </field>
        </record>

        <!-- Actions and Menuitems -->
       <record id="action_mail_statistics_report" model="ir.actions.act_window">
           <field name="name">Mass Mailing Analysis</field>
           <field name="res_model">mail.statistics.report</field>
           <field name="view_type">form</field>
           <field name="view_mode">graph</field>
           <field name="help">Mass Mailing Statistics allows you to check different mailing related information like number of bounced mails, opened mails, replied mails. You can sort out your analysis by different groups to get accurate grained analysis.</field>
       </record>
       <record id="action_mail_mass_mailing_report_graph" model="ir.actions.act_window.view">
            <field name="view_mode">graph</field>
            <field name="view_id" ref="view_mail_statistics_report_graph"/>
            <field name="act_window_id" ref="action_mail_statistics_report"/>
       </record>

       <menuitem name="Mass Mailing Analysis" id="menu_mass_mailing_report" sequence="1"
            parent="base.marketing_reporting_menu" action="action_mail_statistics_report"/>

    </data>
</openerp>
