<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="view_project_issue_report_graph" model="ir.ui.view">
            <field name="name">project.issue.report.graph</field>
            <field name="model">project.issue.report</field>
            <field name="arch" type="xml">
                <graph orientation="horizontal" string="Project Issue" type="pivot" stacked="True">
                    <field name="project_id" type="row"/>
                    <field name="create_date" interval="month" type="col"/>
                    <field name="nbr" type="measure"/>
                </graph>
            </field>
        </record>

        <!-- Custom reports (aka filters) -->
        <record id="filter_issue_report_delay" model="ir.filters">
            <field name="name">Delay</field>
            <field name="model_id">project.issue.report</field>
            <field name="user_id" eval="False"/>
            <field name="context">{'group_by': ['project_id'], 'measures': ['delay_close', 'delay_open']}</field>
        </record>
        <record id="filter_issue_report_responsible" model="ir.filters">
            <field name="name">By Responsible</field>
            <field name="model_id">project.issue.report</field>
            <field name="user_id" eval="False"/>
            <field name="context">{'group_by': ['project_id', 'user_id']}</field>
        </record>

        <record id="view_project_issue_report_filter" model="ir.ui.view">
            <field name="name">project.issue.report.select</field>
            <field name="model">project.issue.report</field>
            <field name="arch" type="xml">
                <search string="Search">
                    <field name="project_id"/>
                    <field name="user_id"/>
                    <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
                    <field name="version_id"/>
                    <field name="stage_id"/>
                    <filter string="My Issues" domain="[('user_id','=',uid)]" />
                    <filter string="Unassigned" name="unassigned" domain="[('user_id','=',False)]"/>
                    <separator/>
                    <filter string="New" name="new" domain="[('stage_id.sequence', '&lt;=', 1)]"/>
                    <group  expand="1" string="Group By">
                        <filter string="Assigned to" name="Responsible" context="{'group_by':'user_id'}" />
                        <filter string="Project" name="project" context="{'group_by':'project_id'}" />
                        <filter string="Task" context="{'group_by':'task_id'}"/>
                        <filter string="Priority" context="{'group_by':'priority'}" />
                        <filter string="Stage" context="{'group_by':'stage_id'}"/>
                        <filter string="Company" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
                        <separator/>
                        <filter string="Create Day" context="{'group_by':'create_date:day'}" help="Create Date"/>
                   </group>
               </search>
            </field>
        </record>

        <record id="action_project_issue_report" model="ir.actions.act_window">
            <field name="name">Issues Analysis</field>
            <field name="res_model">project.issue.report</field>
            <field name="view_type">form</field>
              <field name="view_mode">graph</field>
              <field name="context">{'search_default_year':1,'search_default_This Month':1,'search_default_project':1,'group_by_no_leaf':1,'group_by':[]}</field>
            <field name="view_id" ref="view_project_issue_report_graph"/>
            <field name="search_view_id" ref="view_project_issue_report_filter"/>
            <field name="help">This report on the project issues allows you to analyse the quality of your support or after-sales services. You can track the issues per age. You can analyse the time required to open or close an issue, the number of email to exchange and the time spent on average by issues.</field>
        </record>

        <record model="ir.actions.act_window.view" id="action_project_issue_report_graph">
            <field name="sequence" eval="2"/>
            <field name="view_mode">graph</field>
            <field name="view_id" ref="view_project_issue_report_graph"/>
            <field name="act_window_id" ref="action_project_issue_report"/>
        </record>
        <menuitem action="action_project_issue_report" id="menu_project_issue_report_tree"
            parent="base.menu_project_report"/>


  </data>
</openerp>
