<?xml version='1.0' encoding='utf-8' ?>
<odoo>
    <record id="hr_holidays.group_hr_holidays_user" model="res.groups">
        <field name="name">Time off/Team manager</field>
        <field
            name="rule_groups"
            eval="[(6, 0, [ref('hr_holidays.resource_leaves_holidays_user'), ref('hr_holidays.hr_leave_report_rule_group_holiday_user')])]"
        />
    </record>

    <record id="group_hr_holidays_officer" model="res.groups">
        <field name="name">Time off/Holiday Officer</field>
        <field
            name="implied_ids"
            eval="[(4, ref('hr_holidays.group_hr_holidays_user'))]"
        />
        <field name="category_id" ref="base.module_category_human_resources_time_off" />
        <field
            name="rule_groups"
            eval="[(6, 0, [ref('hr_holidays.hr_leave_allocation_rule_officer_update'), ref('hr_holidays.hr_leave_rule_officer_update'),ref('hr_holidays.hr_leave_allocation_rule_officer_read'),ref('hr_holidays.hr_leave_rule_user_read')])]"
        />
    </record>

    <record id="hr_holidays.group_hr_holidays_manager" model="res.groups">
        <field
            name="implied_ids"
            eval="[(6, 0, [ref('hr_holidays_team_manager.group_hr_holidays_officer')])]"
        />
    </record>

    <record id="team_manager_time_off_same_department" model="ir.rule">
        <field name="name">Time off: Team manager time off same department</field>
        <field name="model_id" ref="hr_holidays.model_hr_leave" />
        <field name="domain_force">['|',
                ('employee_id.department_id', 'in',[user.employee_ids.department_id.id]),
                ('employee_ids.department_id', 'in',   [user.employee_ids.department_id.id])]
        </field>
        <field name="groups" eval="[(4, ref('hr_holidays.group_hr_holidays_user'))]" />
        <field name="perm_read" eval="True" />
        <field name="perm_create" eval="True" />
        <field name="perm_write" eval="True" />
        <field name="perm_unlink" eval="True" />
    </record>


    <record id="team_manager_time_off_allocation_same_department" model="ir.rule">
        <field
            name="name"
        >Time off: Team manager time off allocation same department</field>
        <field name="model_id" ref="hr_holidays.model_hr_leave_allocation" />
        <field name="domain_force">['|',
            ('employee_id.department_id', 'in', [user.employee_ids.department_id.id]),
            ('employee_ids.department_id', 'in',[user.employee_ids.department_id.id])]</field>
        <field name="groups" eval="[(4, ref('hr_holidays.group_hr_holidays_user'))]" />
        <field name="perm_read" eval="True" />
        <field name="perm_create" eval="True" />
        <field name="perm_write" eval="True" />
        <field name="perm_unlink" eval="True" />
    </record>
</odoo>
