<?xml version="1.0"?>
<openerp>
    <data>

        <record model ="ir.ui.view" id="report_event_registration_graph">
            <field name="name">report.event.registration.graph</field>
            <field name="model">report.event.registration</field>
            <field name="arch" type="xml">
                <graph string="Event on Registration"  type="pivot" >
                    <field name="event_type" type="row"/>
                    <field name="event_date" interval="month" type="col"/>
                    <field name="nbregistration" type="measure"/>
                    <field name="confirm_state" type="measure"/>
                </graph>
            </field>
        </record>

        <!-- Event on Registration search view -->
        <record model="ir.ui.view" id="view_report_event_registration_search">
            <field name="name">report.event.registration.search</field>
            <field name="model">report.event.registration</field>
            <field name="arch" type="xml">
                <search string="Event on Registration">
                    <filter string="New" domain="[('event_state','=','draft')]" help="Events which are in New state"/>
                    <filter string="Confirm" domain="[('event_state','=','confirm')]" help="Events which are in confirm state"/>
                    <separator/>
                    <filter string="My Events" help="My Events" domain="[('user_id','=',uid)]"/>
                    <field name="event_id" string="Event"/>
                    <field name="user_id"/>
                    <group expand="0" string="Extended Filters...">
                        <field name="event_type" widget="selection"/>
                        <field name="event_date"/>
                    </group>
                    <newline/>
                    <group expand="1" string="Group By">
                        <filter string="Participant" context="{'group_by':'name_registration'}" help="Registration contact"/>
                        <filter string="Event Type" context="{'group_by':'event_type'}"/>
                        <filter string="Event" name="event" context="{'group_by':'event_id', 'max_reg_event_visible':0}"/>
                        <filter string="Event State" context="{'group_by':'event_state'}"/>
                        <filter string="Company" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
                        <separator/>
                        <filter string="Event Month" context="{'group_by':'event_date:month'}" help="Event Beginning Date"/>
                    </group>
                    <group expand="0" string="Display">
                        <filter string="Show Confirmed Registrations" domain="[('event_state','&lt;&gt;','draft')]"
                              help="Registrations in confirmed or done state" context="{'no_of_draft_invisible':1}"/>
                    </group>
                </search>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_report_event_registration">
            <field name="name">Events Analysis</field>
            <field name="res_model">report.event.registration</field>
            <field name="view_type">form</field>
            <field name="view_mode">graph</field>
            <field name="search_view_id" ref="view_report_event_registration_search"/>
            <field name="context">{"group_by_no_leaf":1, "group_by":[]}</field>
        </record>

        <record model="ir.actions.act_window.view" id="action_report_event_registration_graph">
            <field name="sequence" eval="2"/>
            <field name="view_mode">graph</field>
            <field name="view_id" ref="report_event_registration_graph"/>
            <field name="act_window_id" ref="action_report_event_registration"/>
        </record>

        <menuitem parent="base.menu_reporting" id="menu_reporting_events" sequence="30" groups="event.group_event_manager" name="Events"/>
        <menuitem parent="menu_reporting_events" action="action_report_event_registration" id="menu_report_event_registration" sequence="3" groups="event.group_event_manager"/>

    </data>
</openerp>
