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

        <record model="ir.module.category" id="module_category_all_Library">
            <field name="name">Library</field>
            <field name="description">Helps you manage your institutes different-different users.</field>
            <field name="sequence">107</field>
            <field name="parent_id" eval="False"/>
        </record>
        <record id="module_privilege_openeducat_library" model="res.groups.privilege">
            <field name="name">Library</field>
            <field name="description">Helps you manage your institutes different-different users.</field>
            <field name="category_id" ref="module_category_all_Library"/>
            <field name="sequence">18</field>
        </record>
        <record id="group_op_library_user" model="res.groups">
            <field name="name">User</field>
            <field name="privilege_id" ref="module_privilege_openeducat_library"/>
            <field name="user_ids" eval="[(4, ref('base.user_admin'))]"/>
            <field name="implied_ids"
                   eval="[(4, ref('base.group_user'))]"/>
        </record>
        <record id="group_op_library" model="res.groups">
            <field name="name">Manager</field>
            <field name="privilege_id" ref="module_privilege_openeducat_library"/>
            <field name="implied_ids"
                   eval="[(4, ref('base.group_user')),(4, ref('account.group_account_invoice')),(4, ref('openeducat_library.group_op_library_user'))]"/>
            <field name="user_ids" eval="[(4, ref('base.user_admin'))]"/>
        </record>

        <!-- Rule for Media Queue Request to see own Record. -->
        <record model="ir.rule" id="group_student_media_request_rule">
            <field name="name">See Own media Queue Request</field>
            <field name="model_id" ref="model_op_media_queue"/>
            <field name="domain_force">['|', ('user_id','=',user.id), ('user_id', 'in', user.child_ids.ids)]</field>
            <field name="groups"
                   eval="[(4, ref('openeducat_library.group_op_library'))]"/>
        </record>

        <!-- Rule for Media Movement to see own Record. -->
        <record model="ir.rule" id="group_student_media_Movement_rule">
            <field name="name">Media Movement For Group Student</field>
            <field name="model_id" ref="model_op_media_movement"/>
            <field name="domain_force">['|', ('user_id','=',user.id), ('user_id', 'in', user.child_ids.ids),
                ('state','in',['issue'])]
            </field>
            <field name="groups"
                   eval="[(4, ref('openeducat_library.group_op_library_user')),(4, ref('openeducat_library.group_op_library'))]"/>
        </record>

        <!-- Rule for Media Movement to see ALL Record with Library Group. -->
        <record model="ir.rule" id="group_library_media_Movement_rule">
            <field name="name">Media Movement For Group Library</field>
            <field name="model_id" ref="model_op_media_movement"/>
            <field name="domain_force">[(1,'=',1)]</field>
            <field name="groups"
                   eval="[(4, ref('openeducat_library.group_op_library'))]"/>
        </record>

        <record model="ir.rule" id="view_media_request_rule">
            <field name="name">View Media Queue</field>
            <field name="model_id" ref="model_op_media_queue"/>
            <field name="domain_force">[(1,'=',1)]</field>
            <field name="groups"
                   eval="[(4, ref('openeducat_library.group_op_library_user'))]"/>
        </record>


</odoo>
