<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
    <record id="hr_timesheet_rule_request_user" model="ir.rule">
        <field
            name="name"
        >Users are allowed to access timesheets related to a followed request</field>
        <field name="model_id" ref="model_account_analytic_line" />
        <field name="domain_force">[
                ('maintenance_request_id.message_partner_ids', 'in', [user.partner_id.id]),
                ('maintenance_request_id.user_id.id', '=', user.id)
            ]
        </field>
        <field
            name="groups"
            eval="[(4, ref('hr_timesheet.group_hr_timesheet_user'))]"
        />
    </record>
    <record id="hr_timesheet_rule_request_manager" model="ir.rule">
        <field
            name="name"
        >Managers are allowed to access timesheets related to any request</field>
        <field name="model_id" ref="model_account_analytic_line" />
        <field name="domain_force">
            [('maintenance_request_id', '!=', False)]
        </field>
        <field name="groups" eval="[(4, ref('maintenance.group_equipment_manager'))]" />
    </record>
</odoo>
