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

    <record id="project_consultant_custom_report_view_pivot" model="ir.ui.view">
        <field name="name">project.consultant.custom.report.pivot</field>
        <field name="model">project.consultant.custom.report</field>
        <field name="arch" type="xml">
            <pivot string="Consultant Analysis" disable_linking="True" sample="1">
                 <field name="project_id" type="row"/>
                 <field name="percentage" type="measure"/>
                 <field name="budgeted_hours" type="measure"/>
                 <field name="actual_percentage" type="measure"/>
                 <field name="actual_hours" type="measure"/>
            </pivot>
        </field>
    </record>

    <record id="project_consultant_custom_report_view_graph" model="ir.ui.view">
        <field name="name">project.consultant.custom.report.graph</field>
        <field name="model">project.consultant.custom.report</field>
        <field name="arch" type="xml">
            <graph string="Consultant Analysis" type="bar" stacked="True" sample="1" disable_linking="1">
                <field name="project_id" type="col"/>
                <field name="budgeted_hours" type="row"/>
                <field name="actual_hours" type="row"/>
             </graph>
         </field>
    </record>

    <record id="project_consultant_custom_report_view_tree" model="ir.ui.view">
        <field name="name">project.consultant.custom.report.tree</field>
        <field name="model">project.consultant.custom.report</field>
        <field name="arch" type="xml">
            <tree string="Consultant Analysis" create="false" edit="false" delete="false">
                <field name="project_id"/>
                <field name="employee_id"/>
                <field name="start_date"/>
                <field name="end_date"/>
                <field name="percentage"/>
                <field name="budgeted_hours"/>
                <field name="actual_percentage"/>
                <field name="actual_hours"/>
                <field name="parent_project" optional="hide"/>
             </tree>
         </field>
    </record>


    <record id="project_consultant_custom_report_view_search" model="ir.ui.view">
        <field name="name">project.consultant.custom.report.search</field>
        <field name="model">project.consultant.custom.report</field>
        <field name="arch" type="xml">
            <search string="Consultant Analysis">
                <field name="project_id"/>
                <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
                <field name="employee_id"/>
                <group expand="1" string="Group By">
                    <filter string="Project" name="group_project" context="{'group_by':'project_id'}"/>
                    <filter string="Consultant" name="group_employee" context="{'group_by':'employee_id'}"/>
                    <filter string="Client" name="group_partner_id" context="{'group_by':'partner_id'}"/>
                    <filter string="Start Date" name="group_startdate" domain="[]" context="{'group_by':'start_date:month'}"/>
                    <filter string="End Date" name="group_enddate" domain="[]" context="{'group_by':'end_date:month'}"/>
                </group>
            </search>
        </field>
    </record>

    <record id="project_consultant_custom_report_action" model="ir.actions.act_window">
        <field name="name">Consultant Allocation Reports</field>
        <field name="res_model">project.consultant.custom.report</field>
        <field name="view_mode">pivot,tree,graph</field>
        <field name="search_view_id" ref="project_consultant_custom_report_view_search"/>
         <field name="context">{'search_default_group_project': 1,'search_default_group_employee': 1}</field>
    </record>

    <menuitem id="menu_project_consultant_custom_report"
        parent="project.menu_project_report"
        action="project_consultant_custom_report_action"
        name="Consultant Allocation Reports"
        sequence="51"/>

</odoo>
