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

        <record id="view_report_project_maintenance_pivot" model="ir.ui.view">
            <field name="name">report.project.maintenance.pivot</field>
            <field name="model">report.project.maintenance</field>
            <field name="arch" type="xml">
                <pivot string="Maintenance Analysis" display_quantity="true" disable_linking="True" sample="1">
                    <field name="project_id" type="row"/>
                    <field name="maintenance_type_id" type="col"/>
                    <field name="cost" type="measure"/>
                </pivot>
            </field>
        </record>

        <record id="view_report_project_maintenance_graph" model="ir.ui.view">
            <field name="name">report.project.maintenance.graph</field>
            <field name="model">report.project.maintenance</field>
            <field name="arch" type="xml">
                <graph string="Maintenance Analysis" stacked="True" sample="1" disable_linking="1">
                     <field name="project_id" type="row"/>
                      <field name="maintenance_type_id" type="row"/>
                     <field name="maintenance_id" type="col"/>
                     <field name="cost" type="measure"/>
                 </graph>
             </field>
        </record>

        <record id="view_report_project_maintenance_search" model="ir.ui.view">
            <field name="name">report.project.maintenance.search</field>
            <field name="model">report.project.maintenance</field>
            <field name="arch" type="xml">
                <search string="Maintenance Analysis">
                    <field name="maintenance_id"/>
                    <field name="maintenance_type_id"/>
                    <group expand="1" string="Group By">
                        <filter string="Project" name="project" context="{'group_by': 'project_id'}"/>
                        <filter string="Maintenance Type" name="maintenance_type_id" context="{'group_by':'maintenance_type_id'}"/>
                        <filter string="Maintenance" name="maintenance" context="{'group_by': 'maintenance_id'}"/>
                    </group>
                </search>
            </field>
        </record>

       <record id="action_report_project_maintenance" model="ir.actions.act_window">
            <field name="name">Maintenance Analysis</field>
            <field name="res_model">report.project.maintenance</field>
            <field name="view_mode">graph,pivot</field>
            <field name="search_view_id" ref="view_report_project_maintenance_search"/>
            <field name="context">{'group_by_no_leaf':1,'group_by':[]}</field>
        </record>

      <menuitem id="menu_project_report_maintenance_analysis"
            name="Maintenance Analysis"
            action="action_report_project_maintenance"
            parent="project.menu_project_report"
            sequence="11"/>
</odoo>
