<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <record id="personal_equipment_request_only_self_user" model="ir.rule">
        <field
            name="name"
        >Access only self user's employee personal equipment request</field>
        <field name="model_id" ref="model_hr_personal_equipment_request" />
        <field
            name="domain_force"
        >[('employee_id', 'in', user.employee_ids.ids)]</field>
        <field name="groups" eval="[(4, ref('base.group_user'))]" />
    </record>
    <record id="personal_equipment_request_all_manager" model="ir.rule">
        <field name="name">Access all employee personal equipment request</field>
        <field name="model_id" ref="model_hr_personal_equipment_request" />
        <field name="domain_force">[(1, '=', 1)]</field>
        <field name="groups" eval="[(4, ref('hr.group_hr_user'))]" />
    </record>
    <record id="personal_equipment_only_self_user" model="ir.rule">
        <field name="name">Access only self user's employee personal equipment</field>
        <field name="model_id" ref="model_hr_personal_equipment" />
        <field
            name="domain_force"
        >[('equipment_request_id.employee_id', 'in', user.employee_ids.ids)]</field>
        <field name="groups" eval="[(4, ref('base.group_user'))]" />
    </record>
    <record id="personal_equipment_all_manager" model="ir.rule">
        <field name="name">Access all employee personal equipment</field>
        <field name="model_id" ref="model_hr_personal_equipment" />
        <field name="domain_force">[(1, '=', 1)]</field>
        <field name="groups" eval="[(4, ref('hr.group_hr_user'))]" />
    </record>
    <record id="personal_equipment_draft_state" model="ir.rule">
        <field
            name="name"
        >Delete employee personal equipment only in draft state</field>
        <field name="model_id" ref="model_hr_personal_equipment" />
        <field name="domain_force">[('state', '=', 'draft')]</field>
        <field name="global" eval="True" />
        <field name="perm_create" eval="False" />
        <field name="perm_write" eval="False" />
        <field name="perm_read" eval="False" />
        <field name="perm_unlink" eval="True" />
    </record>
</odoo>
