flectra/addons/maintenance/security/maintenance.xml
2018-01-16 02:34:37 -08:00

41 lines
2.0 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<flectra>
<!-- This group is only allowed to deal with equipment registration and maintenance -->
<record id="group_equipment_manager" model="res.groups">
<field name="name">Equipment Manager</field>
<field name="category_id" ref="base.module_category_human_resources"/>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="comment">The user will be able to manage equipments.</field>
</record>
<!-- Rules -->
<record id="equipment_request_rule_user" model="ir.rule">
<field name="name">Users are allowed to access their own maintenance requests</field>
<field name="model_id" ref="model_maintenance_request"/>
<field name="domain_force">['|', ('message_partner_ids', 'in', [user.partner_id.id]), ('technician_user_id.id', '=', user.id)]</field>
<field name="groups" eval="[(4, ref('base.group_user'))]"/>
</record>
<record id="equipment_rule_user" model="ir.rule">
<field name="name">Users are allowed to access equipments they follow</field>
<field name="model_id" ref="model_maintenance_equipment"/>
<field name="domain_force">[('message_partner_ids', 'in', [user.partner_id.id])]</field>
<field name="groups" eval="[(4, ref('base.group_user'))]"/>
</record>
<record id="equipment_request_rule_admin_user" model="ir.rule">
<field name="name">Administrator of maintenance requests</field>
<field name="model_id" ref="model_maintenance_request"/>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(4, ref('group_equipment_manager'))]"/>
</record>
<record id="equipment_rule_admin_user" model="ir.rule">
<field name="name">Equipments administrator</field>
<field name="model_id" ref="model_maintenance_equipment"/>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(4, ref('group_equipment_manager'))]"/>
</record>
</flectra>