<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="view_timesheet_report_graph" model="ir.ui.view">
            <field name="name">timesheet.report.graph</field>
            <field name="model">hr.timesheet.report</field>
            <field name="inherit_id" ref="hr_timesheet.view_hr_timesheet_report_graph"/>
            <field name="arch" type="xml">
                <field name="user_id" position="after">
                    <field name="to_invoice" type="row"/>
                </field>
                <field name="quantity" position="after">
                    <field name="total_diff" type="measure"/>
                    <field name="total_timesheet" type="measure"/>
                    <field name="total_attendance" type="measure"/>
                </field>
            </field>
        </record>

        <!-- Custom reports (aka filters) -->
        <record id="filter_hr_timesheet_report_internal_timesheets" model="ir.filters">
            <field name="name">Internal Timesheet</field>
            <field name="model_id">hr.timesheet.report</field>
            <field name="domain">[('state','=','done'), ('date','&lt;=', time.strftime('%Y-%m-%d')),('date','&gt;=',time.strftime('%Y-%m-01'))]</field>
            <field name="user_id" eval="False"/>
            <field name="context">{'group_by': ['user_id'], 'col_group_by': ['department_id'], 'measures': ['time']}</field>
        </record>
        <record id="filter_hr_timesheet_report_external_timesheets" model="ir.filters">
            <field name="name">External Timesheet</field>
            <field name="model_id">hr.timesheet.report</field>
            <field name="domain">[('state','=','done'), ('date','&lt;=', time.strftime('%Y-%m-%d')),('date','&gt;=',time.strftime('%Y-%m-01'))]</field>
            <field name="user_id" eval="False"/>
            <field name="context">{'group_by': ['company_id', 'to_invoice'], 'col_group_by': ['user_id'], 'measures': ['time','cost']}</field>
        </record>

        <record id="view_timesheet_report_search" model="ir.ui.view">
            <field name="name">timesheet.report.search</field>
            <field name="model">hr.timesheet.report</field>
            <field name="inherit_id" ref="hr_timesheet.view_hr_timesheet_report_search"/>
            <field name="arch" type="xml">
                <field name="account_id"  position="before">
                    <filter string="Draft" domain="[('state','=','draft')]"/>
                    <filter string="Confirmed" domain="[('state','=','confirm')]"/>
                    <filter string="Done" domain="[('state','=','done')]"/>
                </field>
                <field name="general_account_id" position="after">
                    <field name="to_invoice"/>
                    <field name="department_id"/>
                    <field name="date_to"/>
                    <field name="date_from"/>
                </field>
                <filter name="group_user_id" position="after">
                    <filter string="Department" context="{'group_by':'department_id'}"/>
                    <filter string="Type of Invoicing" context="{'group_by':'to_invoice'}"/>
                    <filter string="Status" context="{'group_by':'state'}"/>
                </filter>
            </field>
        </record>

    </data>
</openerp>
