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

    <!-- Work Entry Type -->
    <record id="hr_work_entry_type_view_form_inherit" model="ir.ui.view">
        <field name="name">hr.work.entry.type.form.inherit</field>
        <field name="model">hr.work.entry.type</field>
        <field name="inherit_id" ref="hr_work_entry.hr_work_entry_type_view_form"/>
        <field name="arch" type="xml">
            <xpath expr="//group[@name='main_group']" position="after">
                <group name="overtime_group">
                    <field name="overtime_work_type_id"
                           domain="[('id', '!=', id)]"
                           attrs="{'required': [('overtime_type_id', '!=', False)]}" />
                    <field name="overtime_type_id"
                           domain="[('id', '!=', id)]"
                           attrs="{'required': [('overtime_work_type_id', '!=', False)]}" />

                    <field name="override_ids" nolabel="1" colspan="2">
                        <tree editable="top">
                            <field name="work_type_id"/>
                            <field name="multiplier"/>
                            <field name="date"/>
                            <field name="day_of_week"/>
                            <field name="name"/>
                        </tree>
                    </field>
                </group>
            </xpath>
        </field>
    </record>
    
    <!-- Work Entry Overtime Type -->
    <record id="hr_work_entry_overtime_type_tree" model="ir.ui.view">
        <field name="name">hr.work.entry.overtime.type.tree</field>
        <field name="model">hr.work.entry.overtime.type</field>
        <field name="arch" type="xml">
            <tree string="Overtime Rules">
                <field name="name"/>
                <field name="hours_per_day"/>
                <field name="hours_per_week"/>
                <field name="multiplier"/>
            </tree>
        </field>
    </record>

    <record id="hr_work_entry_overtime_type_form" model="ir.ui.view">
        <field name="name">hr.work.entry.overtime.type.form</field>
        <field name="model">hr.work.entry.overtime.type</field>
        <field name="arch" type="xml">
            <form string="Overtime Rules">
                <group>
                    <group>
                        <field name="name"/>
                        <field name="multiplier"/>
                    </group>
                    <group>
                        <field name="hours_per_day"/>
                        <field name="hours_per_week"/>
                    </group>
                </group>
                <group name="overrides" string="Overrides">
                    <field name="override_ids" nolabel="1">
                        <tree editable="top">
                            <field name="work_type_id"/>
                            <field name="multiplier"/>
                            <field name="date"/>
                            <field name="day_of_week"/>
                            <field name="name"/>
                        </tree>
                    </field>
                </group>
            </form>
        </field>
    </record>

    <record id="hr_work_entry_overtime_type_search" model="ir.ui.view">
        <field name="name">hr.work.entry.overtime.type.search</field>
        <field name="model">hr.work.entry.overtime.type</field>
        <field name="arch" type="xml">
            <search string="Overtime Rules Search">
                <field name="name"/>
            </search>
        </field>
    </record>

    <record id="hr_work_entry_overtime_type_action_main" model="ir.actions.act_window">
        <field name="name">Overtime Rules</field>
        <field name="res_model">hr.work.entry.overtime.type</field>
        <field name="view_mode">tree,form</field>
        <field name="help" type="html">
            <p>
                No Overtime Rules
            </p>
        </field>
    </record>

    <menuitem id="hr_work_entry_overtime_type_menu_main" name="Overtime Rules"
              action="hr_work_entry_overtime_type_action_main"
              sequence="11" parent="hr_work_entry_contract_enterprise.menu_hr_work_entry_type_view"/>

</odoo>