<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2019 Creu Blanca
     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
    <record model="ir.ui.view" id="hr_attendance_view_form">
        <field name="name">hr.attendance.form</field>
        <field name="model">hr.attendance</field>
        <field name="inherit_id" ref="hr_attendance.hr_attendance_view_form" />
        <field name="arch" type="xml">
            <field name="check_out" position="after">
                <field name="time_changed_manually" />
            </field>
            <sheet position="after">
                <div class="oe_chatter">
                    <field
                        name="message_follower_ids"
                        widget="mail_followers"
                        groups="base.group_user"
                    />
                    <field name="message_ids" widget="mail_thread" />
                </div>
            </sheet>
        </field>
    </record>
    <!--  insert in tree view 'Time Changed' new field  -->
    <record id="hr_attendance_view_tree" model="ir.ui.view">
        <field name="name">hr.attendance.tree</field>
        <field name="model">hr.attendance</field>
        <field name="inherit_id" ref="hr_attendance.view_attendance_tree" />
        <field name="arch" type="xml">
            <xpath expr="//field[@name='check_out']" position="after">
                <field name="time_changed_manually" />
            </xpath>
        </field>
    </record>
    <record id="hr_attendance_view_tree_open" model="ir.ui.view">
        <field name="name">hr.attendance.tree</field>
        <field name="model">hr.attendance</field>
        <field name="priority">99</field>
        <field name="inherit_id" ref="hr_attendance.view_attendance_tree" />
        <field name="arch" type="xml">
            <xpath expr="//field[last()]" position="after">
                <button
                    name="get_formview_action"
                    type="object"
                    string="Open"
                    class="btn btn-primary"
                />
            </xpath>
        </field>
    </record>
    <!--  insert in search filter and Group by using a new field 'Time Changed'  -->
    <record id="hr_attendance_view_search" model="ir.ui.view">
        <field name="name">hr.attendance.search</field>
        <field name="model">hr.attendance</field>
        <field name="type">search</field>
        <field name="inherit_id" ref="hr_attendance.hr_attendance_view_filter" />
        <field name="arch" type="xml">
            <filter name="nocheckout" position="after">
                <filter
                    name="time_changed_manually"
                    string="Time Changed"
                    domain="[('time_changed_manually', '=', True)]"
                />
            </filter>
            <filter name="groupby_check_out" position="after">
                <field name="time_changed_manually" string="Time Changed" />
                <filter
                    name="group_by_time_changed_manually"
                    string="Time Changed"
                    context="{'group_by':'time_changed_manually'}"
                />
            </filter>
        </field>
    </record>
</odoo>
