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

    <record id="project_budget_hrs_report_view_pivot" model="ir.ui.view">
        <field name="name">project.budget.hrs.report.pivot</field>
        <field name="model">project.budget.hrs.report</field>
        <field name="arch" type="xml">
            <pivot string="Budget Analysis" disable_linking="True" sample="1"> <!-- display_quantity="true" -->
                <field name="project_id" type="col"/>
                <field name="hours_type" type="col"/>
                <field name="hours" type="measure"/>
            </pivot>
        </field>
    </record>

    <record id="project_budget_hrs_report_view_graph" model="ir.ui.view">
        <field name="name">project.budget.hrs.report.graph</field>
        <field name="model">project.budget.hrs.report</field>
        <field name="arch" type="xml">
            <graph string="Budget Analysis" type="bar" stacked="False" sample="1" disable_linking="1">
                <field name="project_id" type="row"/>
                <field name="hours_type" type="row"/>
                <field name="hours" type="measure"/>
             </graph>
         </field>
    </record>

    <record id="project_budget_hrs_report_view_tree" model="ir.ui.view">
        <field name="name">project.budget.hrs.report.tree</field>
        <field name="model">project.budget.hrs.report</field>
        <field name="arch" type="xml">
            <tree string="Budget Analysis" create="false" edit="false" delete="false">
                <field name="project_id"/>
                <field name="start_date"/>
                <field name="end_date"/>
                <field name="employee_id"/>
                <!--<field name="timesheet_date" optional="hide"/>-->
                <field name="hours_type"/>
                <field name="hours"/>
                <!--<field name="timeline"/>-->
                <field name="parent_project" optional="hide"/>
             </tree>
         </field>
    </record>


    <record id="project_budget_hrs_report_view_search" model="ir.ui.view">
        <field name="name">project.budget.hrs.report.search</field>
        <field name="model">project.budget.hrs.report</field>
        <field name="arch" type="xml">
            <search string="Budget Analysis">
                <field name="project_id"/>
                <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
                <field name="employee_id"/>
                <field name="start_date"/>
                <field name="end_date"/>
                <!--<field name="timesheet_date"/>-->
                <filter string="Fixed rate" name="fixed" domain="[('pricing_type','=','fixed_rate')]"/>
                <filter string="Hours are budgeted according to a consultant" name="cons" domain="[('project_type','=','hours_in_consultant')]"/>
                <filter string="Total hours are budgeted without division to consultant" name="limit" domain="[('project_type','=','hours_no_limit')]"/>
                <filter string="Not Fixed rate" name="notfixed" domain="[('pricing_type','!=','fixed_rate')]"/>
                <!--<filter string="Sub Project" name="subproject" domain="[('is_sub_project','=',True)]"/>-->
                <group expand="1" string="Group By">
                    <filter string="Project" name="group_by_project" context="{'group_by':'project_id'}"/>
                    <filter string="Client" name="group_by_partner_id" context="{'group_by':'partner_id'}"/>
                    <filter string="Consultant" name="group_by_employee_id" context="{'group_by':'employee_id'}"/>
                    <filter string="Start Date" name="sdate" domain="[]" context="{'group_by':'start_date:day'}"/>
                    <filter string="End Date" name="edate" domain="[]" context="{'group_by':'end_date:day'}"/>
                    <!--<filter string="Timesheet Date" name="tdate" domain="[]" context="{'group_by':'timesheet_date:day'}"/>-->
                    <filter string="Hours type" name="group_by_hours_type" context="{'group_by':'hours_type'}"/>
                </group>
            </search>
        </field>
    </record>

    <record id="project_budget_hrs_report_view_action" model="ir.actions.act_window">
        <field name="name">Projects Hours Acutal Vs Budget</field>
        <!--<field name="name">Projects Revenue Acutal Vs Budget</field>-->
        <field name="res_model">project.budget.hrs.report</field>
        <field name="view_mode">graph,tree,pivot</field>
        <field name="search_view_id" ref="project_budget_hrs_report_view_search"/>
        <field name="context">{'search_default_group_by_project': 1,'search_default_sdate': 1,'search_default_edate': 1,'search_default_group_by_hours_type': 1, 'default_res_model': 'project.budget.hrs.report','search_default_notfixed':1}</field>
    </record>

    <menuitem id="menu_project_budget_report_hrs_analysis"
        parent="project.menu_project_report"
        action="project_budget_hrs_report_view_action"
        name="Projects Hours Acutal Vs Budget"
        sequence="50"/>

</odoo>
