<?xml version="1.0"?>
<openerp>
    <data>
        <!--
         Board for statistical view of the sections
         -->

         <record model="ir.ui.view" id="view_crm_opportunity_categ_graph">
            <field name="name">Opportunities By Categories - Graph</field>
            <field name="model">crm.lead.report</field>
            <field name="type">graph</field>
            <field name="arch" type="xml">
                <graph string="Opportunity by Categories" type="bar" orientation="horizontal">
                    <field name="categ_id"/>
                    <field name="nbr" operator="+"/>
                </graph>
            </field>
        </record>

        <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="type">graph</field>
            <field name="arch" type="xml">
                <graph string="Opportunities By Stage" type="pie">
                    <field name="stage_id"/>
                    <field name="nbr" operator="+"/>
                </graph>
            </field>
        </record>

        <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="type">graph</field>
            <field name="arch" type="xml">
                <graph string="Opportunities By Stage" type="bar">
                    <field name="stage_id"/>
                    <field name="planned_revenue" operator="+"/>
                    <field name="user_id" group="True"/>
                </graph>
            </field>
        </record>

        <record model="ir.actions.act_window" id="act_oppor_categ">
            <field name="name">Opportunities By Categories</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_categ_graph"/>
            <field name="domain">[('state', 'not in', ('done', 'cancel')), ('type', '=', 'opportunity')]</field>
            <field name="context">{'search_default_Category':1}</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>

        <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')]</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="type">form</field>
            <field name="arch" type="xml">
                <form string="Statistics Dashboard">
                    <hpaned>
                        <child1>
                            <action
                                string="Opportunities by Categories"
                                name="%(act_oppor_categ)d"
                                colspan="4"
                                height="200"
                                width="250"/>

                            <action
                                string="Opportunities by Stage"
                                name="%(act_opportunity_stage)d"
                                height="200"
                                colspan="4"/>

                        </child1>
                        <child2>

                            <action
                                string="Planned Revenue by Stage and User"
                                name="%(act_oppor_stage_user)d"
                                colspan="4"/>

                        </child2>
                    </hpaned>
                </form>
            </field>
        </record>

        <record model="ir.actions.act_window" id="open_board_statistical_dash">
            <field name="name">CRM Dashboard</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="board.menu_dasboard" name="Dashboard" sequence="0" parent="base.next_id_64"/>

        <menuitem
            name="CRM Dashboard" parent="board.menu_dasboard"
            action="open_board_statistical_dash"
            sequence="0"
            id="menu_board_statistics_dash"
            icon="terp-graph"
            groups="base.group_sale_manager"/>

    </data>
</openerp>
