<?xml version="1.0"?>
<openerp>
     <data>
        <!-- CRM dashboard -->
        <record model="ir.ui.view" id="view_crm_opportunity_stage_graph">
            <field name="name">Opportunities By Stage - Graph</field>
            <field name="model">crm.lead.report</field>
            <field name="arch" type="xml">
                <graph string="Opportunities By Stage" type="area">
                    <field name="stage_id"/>
                    <field name="nbr" operator="+"/>
                </graph>
            </field>
        </record>

        <record model="ir.actions.act_window" id="act_opportunity_stage">
            <field name="name">Opportunities By Stage</field>
            <field name="res_model">crm.lead.report</field>
            <field name="view_type">form</field>
            <field name="view_mode">graph,tree,form</field>
            <field name="view_id" ref="view_crm_opportunity_stage_graph"/>
            <field name="domain">[('state', 'not in', ('done', 'cancel')), ('type', '=', 'opportunity')]</field>
            <field name="context">{'search_default_Stage':1}</field>
        </record>

        <!--Planned Revenue By User line graph-->
        <record model="ir.ui.view" id="view_crm_opportunity_user_stage_graph">
            <field name="name">Opportunities By Stage Per User - Graph</field>
            <field name="model">crm.lead.report</field>
            <field name="arch" type="xml">
                <graph string="Opportunities By Stage" type="line">
                    <field name="stage_id"/>
                    <field name="planned_revenue" operator="+"/>
                    <field name="user_id" group="True"/>
                </graph>
            </field>
        </record>

        <!--Planned Revenue By User line graph action-->
        <record model="ir.actions.act_window" id="act_oppor_stage_user">
            <field name="name">Planned Revenue By User and Stage</field>
            <field name="res_model">crm.lead.report</field>
            <field name="view_type">form</field>
            <field name="view_mode">graph,tree,form</field>
            <field name="view_id" ref="view_crm_opportunity_user_stage_graph"/>
            <field name="domain">[('state','!=','cancel'),('opening_date','&gt;',context_today().strftime("%Y-%m-%d"))]</field>
            <field name="context">{'search_default_Stage':1}</field>
        </record>

        <record model="ir.ui.view" id="board_crm_statistical_form">
            <field name="name">CRM - Statistical Dashboard Form</field>
            <field name="model">board.board</field>
            <field name="arch" type="xml">
                <form string="Statistics Dashboard" version="7.0">
                    <board style="1-1">
                        <column>
                            <action string="Planned Revenue by Stage and User" name="%(act_oppor_stage_user)d"/>
                        </column>
                        <column>
                            <action string="Opportunities by Stage" name="%(act_opportunity_stage)d"/>
                        </column>
                    </board>
                </form>
            </field>
        </record>

        <record model="ir.actions.act_window" id="open_board_statistical_dash">
            <field name="name">CRM</field>
            <field name="res_model">board.board</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="usage">menu</field>
            <field name="view_id" ref="board_crm_statistical_form"/>
        </record>

        <menuitem
            id="menu_board_statistics_dash"
            parent="base.menu_reporting_dashboard"
            action="open_board_statistical_dash"
            sequence="10"
            groups="base.group_sale_manager"/>

    </data>
</openerp>
