<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
 <!-- Report for project issue -->
        <record id="view_project_issue_report_tree" model="ir.ui.view">
            <field name="name">project.issue.report.tree</field>
            <field name="model">project.issue.report</field>
            <field name="arch" type="xml">
                <tree string="Issues Analysis" create="false">
                    <field name="name" invisible="1"/>
                    <field name="month" invisible="1"/>
                    <field name="project_id" invisible="1"/>
                    <field name="stage_id" invisible="1"/>
                    <field name="version_id" string="Version" invisible="1"/>
                    <field name="priority" invisible="1"/>
                    <field name="company_id" invisible="1" groups="base.group_multi_company"/>
                    <field name="section_id" invisible="1"/>
                    <field name="user_id" invisible="1"/>
                    <field name="channel_id" invisible="1"/>
                    <field name="partner_id" invisible="1"/>
                    <field name="task_id" invisible="1"/>
                    <field name="date_closed" invisible="1"/>
                    <field name="state" invisible="1"/>
                    <field name="day" invisible="1"/>
                    <field name="nbr" string="#Project Issues" sum="#Number of Project Issues"/>
                    <field name="delay_open" avg="Avg Opening Delay"/>
                    <field name="delay_close" avg="Avg Closing Delay"/>
                    <field name="working_hours_open" avg="Open Working Hours"/>
                    <field name="working_hours_close" avg="Close Working hours"/>
                    <field name="email" sum="# Emails"/>
                  </tree>
            </field>
        </record>
        <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="bar">
                    <field name="state"/>
                    <field name="nbr" operator="+"/>
                    <field group="True" name="user_id"/>
                </graph>
            </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="creation_date"/>
                    <filter  icon="terp-camera_test" string="New" domain="[('state','=','draft')]"/>
                    <filter  icon="terp-check" string="To Do" domain="[('state','=','open')]"/>
                    <filter icon="terp-gtk-media-pause" string="Pending" domain="[('state','=','pending')]"/>
                    <filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]"/>
                    <field name="project_id"/>
                    <field name="user_id"/>
                    <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
                    <field name="version_id"/>
                    <group  expand="1" string="Group By...">
                        <filter string="Assigned to" name="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}" />
                        <filter string="Contact" icon="terp-partner" context="{'group_by':'partner_id'}" />
                        <filter string="Sale Team" icon="terp-personal+" domain="[]" context="{'group_by':'section_id'}" />
                        <filter string="Project"  name="project" icon="terp-folder-violet" context="{'group_by':'project_id'}" />
                        <filter string="Task"  icon="terp-stock_align_left_24" domain="[]" context="{'group_by':'task_id'}"/>
                        <filter string="Version"  icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'version_id'}"/>
                        <filter string="Priority"  icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" />
                        <filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
                        <filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
                        <filter string="Day" icon="terp-go-today" domain="[]" context="{'group_by':'day'}" help="Creation Date"/>
                        <filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'month'}" help="Creation Date"/>
                        <filter string="Year" icon="terp-go-year" domain="[]" context="{'group_by':'name'}" help="Creation 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,tree</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_tree"/>
            <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_tree">
            <field name="sequence" eval="1"/>
            <field name="view_mode">tree</field>
            <field name="view_id" ref="view_project_issue_report_tree"/>
            <field name="act_window_id" ref="action_project_issue_report"/>
        </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>
