<?xml version="1.0"?>
<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
    <data>

        <menuitem parent="menu_reporting"
            name="Purchases"
            sequence="10"
            id="menu_reporting_purchase"
            icon="tryton-graph"/>

        <record model="ir.ui.view" id="reporting_context_view_form">
            <field name="model">purchase.reporting.context</field>
            <field name="type">form</field>
            <field name="name">purchase_reporting_context_form</field>
        </record>

        <record model="ir.ui.view" id="reporting_main_view_list">
            <field name="model">purchase.reporting.main</field>
            <field name="type">tree</field>
            <field name="name">purchase_reporting_main_list</field>
        </record>

        <record model="ir.ui.view" id="reporting_main_view_graph_expense">
            <field name="model">purchase.reporting.main</field>
            <field name="type">graph</field>
            <field name="name">purchase_reporting_main_graph_expense</field>
        </record>

        <record model="ir.ui.view" id="reporting_main_view_graph_number">
            <field name="model">purchase.reporting.main</field>
            <field name="type">graph</field>
            <field name="name">purchase_reporting_main_graph_number</field>
        </record>

        <record model="ir.action.act_window" id="act_reporting_main">
            <field name="name">Purchases</field>
            <field name="res_model">purchase.reporting.main</field>
            <field name="context_model">purchase.reporting.context</field>
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_main_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="reporting_main_view_list"/>
            <field name="act_window" ref="act_reporting_main"/>
        </record>
        <record model="ir.action.keyword" id="act_reporting_main_keyword1">
            <field name="keyword">tree_open</field>
            <field name="model" ref="menu_reporting_purchase"/>
            <field name="action" ref="act_reporting_main"/>
        </record>

        <record model="ir.rule.group" id="rule_group_reporting_main_companies">
            <field name="name">User in companies</field>
            <field name="model">purchase.reporting.main</field>
            <field name="global_p" eval="True"/>
        </record>
        <record model="ir.rule" id="rule_reporting_main_companies">
            <field name="domain"
                eval="[('company', 'in', Eval('companies', []))]"
                pyson="1"/>
            <field name="rule_group" ref="rule_group_reporting_main_companies"/>
        </record>

        <record model="ir.model.access" id="access_reporting_main">
            <field name="model">purchase.reporting.main</field>
            <field name="perm_read" eval="False"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_reporting_main_purchase">
            <field name="model">purchase.reporting.main</field>
            <field name="group" ref="group_purchase"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>

        <record model="ir.ui.view" id="reporting_main_time_series_view_list">
            <field name="model">purchase.reporting.main.time_series</field>
            <field name="type">tree</field>
            <field name="name">purchase_reporting_main_time_series_list</field>
        </record>

        <record model="ir.ui.view" id="reporting_main_time_series_view_graph_expense">
            <field name="model">purchase.reporting.main.time_series</field>
            <field name="type">graph</field>
            <field name="name">purchase_reporting_main_time_series_graph_expense</field>
        </record>

        <record model="ir.ui.view" id="reporting_main_time_series_view_graph_number">
            <field name="model">purchase.reporting.main.time_series</field>
            <field name="type">graph</field>
            <field name="name">purchase_reporting_main_time_series_graph_number</field>
        </record>

        <record model="ir.action.act_window" id="act_reporting_main_time_series">
            <field name="name">Purchases</field>
            <field name="res_model">purchase.reporting.main.time_series</field>
            <field name="context_model">purchase.reporting.context</field>
            <field name="order" eval="[('date', 'DESC')]" pyson="1"/>
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_main_time_series_list_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="reporting_main_time_series_view_list"/>
            <field name="act_window" ref="act_reporting_main_time_series"/>
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_main_time_series_list_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="reporting_main_time_series_view_graph_expense"/>
            <field name="act_window" ref="act_reporting_main_time_series"/>
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_main_time_series_list_view3">
            <field name="sequence" eval="30"/>
            <field name="view" ref="reporting_main_time_series_view_graph_number"/>
            <field name="act_window" ref="act_reporting_main_time_series"/>
        </record>
        <record model="ir.action.keyword" id="act_reporting_main_time_series_list_keyword1">
            <field name="keyword">tree_open</field>
            <field name="model">purchase.reporting.main,-1</field>
            <field name="action" ref="act_reporting_main_time_series"/>
        </record>

        <record model="ir.rule.group" id="rule_group_reporting_main_time_series_companies">
            <field name="name">User in companies</field>
            <field name="model">purchase.reporting.main.time_series</field>
            <field name="global_p" eval="True"/>
        </record>
        <record model="ir.rule" id="rule_reporting_main_time_series_companies">
            <field name="domain"
                eval="[('company', 'in', Eval('companies', []))]"
                pyson="1"/>
            <field name="rule_group" ref="rule_group_reporting_main_time_series_companies"/>
        </record>

        <record model="ir.model.access" id="access_reporting_main_time_series">
            <field name="model">purchase.reporting.main.time_series</field>
            <field name="perm_read" eval="False"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_reporting_main_time_series_purchase">
            <field name="model">purchase.reporting.main.time_series</field>
            <field name="group" ref="group_purchase"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>

        <!-- Supplier -->

        <record model="ir.ui.view" id="reporting_supplier_view_list">
            <field name="model">purchase.reporting.supplier</field>
            <field name="inherit" ref="reporting_main_view_list"/>
            <field name="name">purchase_reporting_supplier_list</field>
        </record>

        <record model="ir.ui.view" id="reporting_supplier_view_graph_expense">
            <field name="model">purchase.reporting.supplier</field>
            <field name="inherit" ref="reporting_main_view_graph_expense"/>
            <field name="name">purchase_reporting_supplier_graph_expense</field>
        </record>

        <record model="ir.ui.view" id="reporting_supplier_view_graph_number">
            <field name="model">purchase.reporting.supplier</field>
            <field name="inherit" ref="reporting_main_view_graph_number"/>
            <field name="name">purchase_reporting_supplier_graph_number</field>
        </record>

        <record model="ir.action.act_window" id="act_reporting_supplier">
            <field name="name">Purchases per Supplier</field>
            <field name="res_model">purchase.reporting.supplier</field>
            <field name="context_model">purchase.reporting.context</field>
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_supplier_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="reporting_supplier_view_list"/>
            <field name="act_window" ref="act_reporting_supplier"/>
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_supplier_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="reporting_supplier_view_graph_expense"/>
            <field name="act_window" ref="act_reporting_supplier"/>
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_supplier_view3">
            <field name="sequence" eval="30"/>
            <field name="view" ref="reporting_supplier_view_graph_number"/>
            <field name="act_window" ref="act_reporting_supplier"/>
        </record>
        <record model="ir.action.keyword" id="act_reporting_supplier_keyword1">
            <field name="keyword">tree_open</field>
            <field name="model" ref="menu_reporting_purchase"/>
            <field name="action" ref="act_reporting_supplier"/>
        </record>

        <record model="ir.rule.group" id="rule_group_reporting_supplier_companies">
            <field name="name">User in companies</field>
            <field name="model">purchase.reporting.supplier</field>
            <field name="global_p" eval="True"/>
        </record>
        <record model="ir.rule" id="rule_reporting_supplier_companies">
            <field name="domain"
                eval="[('company', 'in', Eval('companies', []))]"
                pyson="1"/>
            <field name="rule_group" ref="rule_group_reporting_supplier_companies"/>
        </record>

        <record model="ir.model.access" id="access_reporting_supplier">
            <field name="model">purchase.reporting.supplier</field>
            <field name="perm_read" eval="False"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_reporting_supplier_purchase">
            <field name="model">purchase.reporting.supplier</field>
            <field name="group" ref="group_purchase"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>

        <record model="ir.ui.view" id="reporting_supplier_time_series_view_list">
            <field name="model">purchase.reporting.supplier.time_series</field>
            <field name="type">tree</field>
            <field name="name">purchase_reporting_main_time_series_list</field>
        </record>

        <record model="ir.ui.view" id="reporting_supplier_time_series_view_graph_expense">
            <field name="model">purchase.reporting.supplier.time_series</field>
            <field name="type">graph</field>
            <field name="name">purchase_reporting_main_time_series_graph_expense</field>
        </record>

        <record model="ir.ui.view" id="reporting_supplier_time_series_view_graph_number">
            <field name="model">purchase.reporting.supplier.time_series</field>
            <field name="type">graph</field>
            <field name="name">purchase_reporting_main_time_series_graph_number</field>
        </record>

        <record model="ir.action.act_window" id="act_reporting_supplier_time_series">
            <field name="name">Purchases per Supplier</field>
            <field name="res_model">purchase.reporting.supplier.time_series</field>
            <field name="context_model">purchase.reporting.context</field>
            <field
                name="domain"
                eval="[('supplier', '=', Eval('active_id', -1))]"
                pyson="1"/>
            <field name="order" eval="[('date', 'DESC')]" pyson="1"/>
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_supplier_time_series_list_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="reporting_supplier_time_series_view_list"/>
            <field name="act_window" ref="act_reporting_supplier_time_series"/>
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_supplier_time_series_list_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="reporting_supplier_time_series_view_graph_expense"/>
            <field name="act_window" ref="act_reporting_supplier_time_series"/>
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_supplier_time_series_list_view3">
            <field name="sequence" eval="30"/>
            <field name="view" ref="reporting_supplier_time_series_view_graph_number"/>
            <field name="act_window" ref="act_reporting_supplier_time_series"/>
        </record>
        <record model="ir.action.keyword" id="act_reporting_supplier_time_series_list_keyword1">
            <field name="keyword">tree_open</field>
            <field name="model">purchase.reporting.supplier,-1</field>
            <field name="action" ref="act_reporting_supplier_time_series"/>
        </record>

        <record model="ir.rule.group" id="rule_group_reporting_supplier_time_series_companies">
            <field name="name">User in companies</field>
            <field name="model">purchase.reporting.supplier.time_series</field>
            <field name="global_p" eval="True"/>
        </record>
        <record model="ir.rule" id="rule_reporting_supplier_time_series_companies">
            <field name="domain"
                eval="[('company', 'in', Eval('companies', []))]"
                pyson="1"/>
            <field name="rule_group" ref="rule_group_reporting_supplier_time_series_companies"/>
        </record>

        <record model="ir.model.access" id="access_reporting_supplier_time_series">
            <field name="model">purchase.reporting.supplier.time_series</field>
            <field name="perm_read" eval="False"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_reporting_supplier_time_series_purchase">
            <field name="model">purchase.reporting.supplier.time_series</field>
            <field name="group" ref="group_purchase"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>

        <!-- Product -->

        <record model="ir.ui.view" id="reporting_product_view_list">
            <field name="model">purchase.reporting.product</field>
            <field name="inherit" ref="reporting_main_view_list"/>
            <field name="name">purchase_reporting_product_list</field>
        </record>

        <record model="ir.ui.view" id="reporting_product_view_graph_expense">
            <field name="model">purchase.reporting.product</field>
            <field name="inherit" ref="reporting_main_view_graph_expense"/>
            <field name="name">purchase_reporting_product_graph_expense</field>
        </record>

        <record model="ir.ui.view" id="reporting_product_view_graph_number">
            <field name="model">purchase.reporting.product</field>
            <field name="inherit" ref="reporting_main_view_graph_number"/>
            <field name="name">purchase_reporting_product_graph_number</field>
        </record>

        <record model="ir.action.act_window" id="act_reporting_product">
            <field name="name">Purchases per Product</field>
            <field name="res_model">purchase.reporting.product</field>
            <field name="context_model">purchase.reporting.context</field>
            <!-- <field name="context" eval="{'supplier': Eval('active_id')}" pyson="1"/> -->
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_product_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="reporting_product_view_list"/>
            <field name="act_window" ref="act_reporting_product"/>
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_product_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="reporting_product_view_graph_expense"/>
            <field name="act_window" ref="act_reporting_product"/>
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_product_view3">
            <field name="sequence" eval="30"/>
            <field name="view" ref="reporting_product_view_graph_number"/>
            <field name="act_window" ref="act_reporting_product"/>
        </record>
        <record model="ir.action.keyword" id="act_reporting_product_keyword1">
            <field name="keyword">tree_open</field>
            <field name="model" ref="menu_reporting_purchase"/>
            <!-- <field name="model">purchase.reporting.supplier,-1</field> -->
            <field name="action" ref="act_reporting_product"/>
        </record>

        <record model="ir.rule.group" id="rule_group_reporting_product_companies">
            <field name="name">User in companies</field>
            <field name="model">purchase.reporting.product</field>
            <field name="global_p" eval="True"/>
        </record>
        <record model="ir.rule" id="rule_reporting_product_companies">
            <field name="domain"
                eval="[('company', 'in', Eval('companies', []))]"
                pyson="1"/>
            <field name="rule_group" ref="rule_group_reporting_product_companies"/>
        </record>

        <record model="ir.model.access" id="access_reporting_product">
            <field name="model">purchase.reporting.product</field>
            <field name="perm_read" eval="False"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_reporting_product_purchase">
            <field name="model">purchase.reporting.product</field>
            <field name="group" ref="group_purchase"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>

        <record model="ir.ui.view" id="reporting_product_time_series_view_list">
            <field name="model">purchase.reporting.product.time_series</field>
            <field name="type">tree</field>
            <field name="name">purchase_reporting_main_time_series_list</field>
        </record>

        <record model="ir.ui.view" id="reporting_product_time_series_view_graph_expense">
            <field name="model">purchase.reporting.product.time_series</field>
            <field name="type">graph</field>
            <field name="name">purchase_reporting_main_time_series_graph_expense</field>
        </record>

        <record model="ir.ui.view" id="reporting_product_time_series_view_graph_number">
            <field name="model">purchase.reporting.product.time_series</field>
            <field name="type">graph</field>
            <field name="name">purchase_reporting_main_time_series_graph_number</field>
        </record>

        <record model="ir.action.act_window" id="act_reporting_product_time_series">
            <field name="name">Purchases per Product</field>
            <field name="res_model">purchase.reporting.product.time_series</field>
            <field name="context_model">purchase.reporting.context</field>
            <field name="domain"
                eval="[('product', '=', Eval('active_id', -1))]"
                pyson="1"/>
            <field name="order" eval="[('date', 'DESC')]" pyson="1"/>
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_product_time_series_list_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="reporting_product_time_series_view_list"/>
            <field name="act_window" ref="act_reporting_product_time_series"/>
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_product_time_series_list_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="reporting_product_time_series_view_graph_expense"/>
            <field name="act_window" ref="act_reporting_product_time_series"/>
        </record>
        <record model="ir.action.act_window.view" id="act_reporting_product_time_series_list_view3">
            <field name="sequence" eval="30"/>
            <field name="view" ref="reporting_product_time_series_view_graph_number"/>
            <field name="act_window" ref="act_reporting_product_time_series"/>
        </record>
        <record model="ir.action.keyword" id="act_reporting_product_time_series_list_keyword1">
            <field name="keyword">tree_open</field>
            <field name="model">purchase.reporting.product,-1</field>
            <field name="action" ref="act_reporting_product_time_series"/>
        </record>

        <record model="ir.rule.group" id="rule_group_reporting_product_time_series_companies">
            <field name="name">User in companies</field>
            <field name="model">purchase.reporting.product.time_series</field>
            <field name="global_p" eval="True"/>
        </record>
        <record model="ir.rule" id="rule_reporting_product_time_series_companies">
            <field name="domain"
                eval="[('company', 'in', Eval('companies', []))]"
                pyson="1"/>
            <field name="rule_group" ref="rule_group_reporting_product_time_series_companies"/>
        </record>

        <record model="ir.model.access" id="access_reporting_product_time_series">
            <field name="model">purchase.reporting.product.time_series</field>
            <field name="perm_read" eval="False"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_reporting_product_time_series_purchase">
            <field name="model">purchase.reporting.product.time_series</field>
            <field name="group" ref="group_purchase"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
    </data>
</tryton>
