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

    <record id="project_revenue_custom_report3_view_pivot" model="ir.ui.view">
        <field name="name">project.revenue.custom.report3.pivot</field>
        <field name="model">project.revenue.custom.report3</field>
        <field name="arch" type="xml">
            <pivot string="Revenue Analysis" disable_linking="True" sample="1">
                 <field name="project_id" type="row"/>
                 <field name="overall_budgeted_revenue" type="measure"/>
                 <field name="budgeted_revenue" type="measure"/>
                 <field name="actual_revenue" type="measure"/>
                 <field name="actual_cost" type="measure"/>
                 <field name="budgeted_hours" type="measure"/>
                 <field name="overall_hourly_rate" type="measure"/>
                 <field name="pro_hourly_rate" type="measure"/>
                 <field name="expenses_amt" type="measure"/>
                 <field name="profit_amt" type="measure"/>
                 <field name="profit_per" type="measure"/>
                 <field name="unit_amount" widget="float_time" type="measure"/>
                 <field name="timesheet_cost" type="measure"/>
            </pivot>
        </field>
    </record>

    <record id="project_revenue_custom_report3_view_graph" model="ir.ui.view">
        <field name="name">project.revenue.custom.report3.graph</field>
        <field name="model">project.revenue.custom.report3</field>
        <field name="arch" type="xml">
            <graph string="Revenue Analysis" type="bar" stacked="True" sample="1" disable_linking="1">
                <field name="project_id" type="col"/>
                <field name="budgeted_revenue" type="row"/>
                <field name="actual_revenue" type="row"/>
                <field name="actual_cost" type="row"/>
             </graph>
         </field>
    </record>

    <record id="project_revenue_custom_report3_view_tree" model="ir.ui.view">
        <field name="name">project.revenue.custom.report3.tree</field>
        <field name="model">project.revenue.custom.report3</field>
        <field name="arch" type="xml">
            <tree string="Revenue Analysis" create="false" edit="false" delete="false">
                <field name="project_id"/>
                <field name="employee_id"/>
                <field name="budgeted_revenue"/>
                <field name="actual_revenue"/>
                <field name="actual_cost"/>
                <field name="budgeted_hours"/>
                <field name="pro_hourly_rate"/>
                <field name="profit_amt"/>
                <field name="profit_per"/>
                <field name="unit_amount" widget="float_time"/>
                <field name="timesheet_cost"/>
                <field name="start_date"/>
                <field name="end_date"/>
             </tree>
         </field>
    </record>


    <record id="project_revenue_custom_report3_view_search" model="ir.ui.view">
        <field name="name">project.revenue.custom.report3.search</field>
        <field name="model">project.revenue.custom.report3</field>
        <field name="arch" type="xml">
            <search string="Revenue Analysis">
                <field name="project_id"/>
                <field name="employee_id"/>
                <filter string="Fixed rate" name="fixed" domain="[('pricing_type','=','fixed_rate')]"/>
                <filter string="Hours are budgeted according to a consultant" name="cons" domain="[('pricing_type','=','employee_rate'),('project_type','=','hours_in_consultant')]"/>
                <filter string="Total hours are budgeted without division to consultant" name="limit" domain="[('pricing_type','=','employee_rate'),('project_type','=','hours_no_limit')]"/>
                <filter string="Start Date" name="filter_start_date" date="start_date"/>
                <filter string="End Date" name="filter_end_date" date="end_date"/>
                <filter string="Active" name="active_project" domain="[('project_active','=',True)]"/>
                <filter string="Archived" name="active_project" domain="[('project_active','=',False)]"/>
                <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="End Date" name="group_enddate" domain="[]" context="{'group_by':'end_date:month'}"/>
                    <!--<filter string="Budgeted Hours" name="budgethrs"
                        domain="[('timesheet_sdatetime','=',False)]"/>
                    <filter string="Current Year" name="currentyear"
                        domain="[('timesheet_sdatetime','&lt;=', time.strftime('%%Y-12-31')),('timesheet_sdatetime','&gt;=',time.strftime('%%Y-01-01'))]"/>
                    <filter string="Last Year" name="lyear" domain="[('timesheet_sdatetime','&gt;=',(context_today()-relativedelta(years=1)).strftime('%%Y-01-01')),('timesheet_sdatetime','&lt;', time.strftime('%%Y-01-01'))]"/>-->
                </group>
            </search>
        </field>
    </record>

    <record id="project_revenue_custom_report3_action" model="ir.actions.act_window">
        <field name="name">Projects Revenue (updated)</field>
        <field name="res_model">project.revenue.custom.report3</field>
        <field name="view_mode">pivot,tree,graph</field>
        <field name="search_view_id" ref="project_revenue_custom_report3_view_search"/>
         <field name="context">{}</field>
    </record>


    <menuitem id="menu_project_revenue_custom_report3"
        parent="project.menu_project_report"
        action="project_revenue_custom_report3_action"
        name="Projects Revenue (upd)"
        sequence="50"/>

</odoo>
