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

        <record id="purchase_draft" model="ir.actions.act_window">
            <field name="name">Request for Quotations</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">purchase.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('state','=','draft')]</field>
            <field name="context">{'quotation_only': True}</field>
        </record>

        <record model="ir.ui.view" id="view_purchase_order_monthly_categ_tree">
            <field name="name">purchase.order.monthly.categ.tree</field>
            <field name="model">purchase.report</field>
            <field name="arch" type="xml">
                <tree string="Monthly Purchase by Category">
                    <field name="month"/>
                    <field name="category_id"/>
                    <field name="price_total"/>
                    <field name="user_id" invisible="1"/>
                    <field name="partner_id" invisible="1"/>
                    <field name="product_id" invisible="1"/>
                    <field name="product_uom" invisible="1"/>
                    <field name="day" invisible="1"/>
                    <field name="name" invisible="1"/>
                    <field name="warehouse_id" invisible="1"/>
                    <field name="validator" invisible="1"/>
                    <field name="company_id" invisible="1"/>
                    <field name="state" invisible="1"/>
                    <field name="location_id" invisible="1"/>
                </tree>
            </field>
        </record>
        <record model="ir.ui.view" id="view_purchase_order_monthly_categ_graph">
            <field name="name">purchase.order.monthly.categ.graph</field>
            <field name="model">purchase.report</field>
            <field name="arch" type="xml">
                <graph string="Monthly Purchase by Category" type="bar">
                    <field name="month"/>
                    <field name="price_total" operator="+"/>
                    <field name="category_id" group="True"/>
                </graph>
            </field>
        </record>
        <record id="action_purchase_order_monthly_categ_graph" model="ir.actions.act_window">
            <field name="name">Monthly Purchase by Category</field>
            <field name="res_model">purchase.report</field>
            <field name="view_type">form</field>
            <field name="view_mode">graph,tree</field>
            <field name="context">{'group_by':['month','category_id'],'group_by_no_leaf':1}</field>
            <field name="domain">[('state','in',('approved','except_picking','except_invoice','done'))]</field>
            <field name="view_id" ref="view_purchase_order_monthly_categ_graph"></field>
        </record>

        <record id="board_purchase_form" model="ir.ui.view">
            <field name="name">board.purchase.form</field>
            <field name="model">board.board</field>
            <field name="arch" type="xml">
                <form string="Purchase Dashboard" version="7.0">
                    <board style="2-1">
                        <column>
                            <action name="%(purchase_draft)d" string="Request for Quotations"/>
                        </column>
                        <column>
                            <action name="%(action_purchase_order_monthly_categ_graph)d" string="Monthly Purchases by Category"/>
                        </column>
                    </board>
                </form>
            </field>
        </record>

        <record id="open_board_purchase" model="ir.actions.act_window">
            <field name="name">Purchases</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_purchase_form"/>
        </record>

        <menuitem action="open_board_purchase"
                  icon="terp-graph"
                  id="menu_board_purchase"
                  parent="base.menu_reporting_dashboard"
                  sequence="20"
                  groups="purchase.group_purchase_user"/>

    </data>
</openerp>
