<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <!-- Sales dashboard -->
        <record id="action_quotation_for_sale" model="ir.actions.act_window">
            <field name="name">My Quotations</field>
            <field name="res_model">sale.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('state','=','draft'),('user_id','=',uid)]</field>
            <field name="view_id" ref="sale.view_order_tree"/>
        </record>

        <record id="view_turnover_by_month_tree" model="ir.ui.view">
            <field name="name">turnover.by.month.tree</field>
            <field name="model">account.invoice.report</field>
            <field name="priority" eval="32"/>
            <field name="arch" type="xml">
                <tree string="Monthly Turnover">
                    <field name="month"/>
                    <field name="price_total"/>
                </tree>
            </field>
        </record>
        <record id="view_turnover_by_month_graph" model="ir.ui.view">
            <field name="name">turnover.by.month.graph</field>
            <field name="model">account.invoice.report</field>
            <field name="priority" eval="32"/>
            <field name="arch" type="xml">
                <graph string="Monthly Turnover" type="bar">
                    <field name="month"/>
                    <field name="price_total" operator="+"/>
                </graph>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_turnover_by_month">
            <field name="name">Monthly Turnover</field>
            <field name="res_model">account.invoice.report</field>
            <field name="view_type">form</field>
            <field name="view_mode">graph,tree</field>
            <field name="view_id" ref="view_turnover_by_month_graph"/>
            <field name="domain">[('year','ilike',time.strftime('%Y')),('user_id','=',uid)]</field>
            <field name="context">{'group_by_no_leaf':1,'group_by':['month']}</field>
        </record>

        <record id="board_sales_form" model="ir.ui.view">
            <field name="name">board.sales.form</field>
            <field name="model">board.board</field>
            <field name="arch" type="xml">
                <form string="Sales Dashboard" version="7.0">
                    <board style="2-1">
                        <column>
                            <action name="%(action_quotation_for_sale)d" string="My Quotations"/>
                        </column>
                        <column>
                            <action name="%(action_turnover_by_month)d" string="Monthly Turnover"/>
                        </column>
                    </board>
                </form>
            </field>
        </record>

        <record id="open_board_sales" model="ir.actions.act_window">
            <field name="name">Sales</field>
            <field name="res_model">board.board</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="view_id" ref="board_sales_form"/>
        </record>

        <menuitem id="menu_dashboard_sales"
                  sequence="15"
                  parent="base.menu_reporting_dashboard"
                  action="open_board_sales"
                  groups="base.group_sale_salesman"/>

    </data>
</openerp>
