<?xml version="1.0" encoding="utf-8"?>
<odoo>
        <record model="ir.module.category" id="base.module_category_marketing">
            <field name="sequence">100</field>
        </record>
        <record model="ir.module.category" id="base.module_category_administration">
            <field name="sequence">40</field>
        </record>
        <record model="ir.module.category" id="base.module_category_human_resources">
            <field name="sequence">45</field>
        </record>
        <record model="ir.module.category" id="module_category_all_openeducat">
            <field name="name">Education</field>
            <field name="description">Helps you manage your institutes different-different users.</field>
            <field name="sequence">101</field>
            <field name="parent_id" eval="False"/>
        </record>
        <record model="res.groups.privilege" id="module_category_all_other_education">
            <field name="name">Education Other</field>
            <field name="description">Helps you manage your institutes different-different users.</field>
            <field name="sequence">20</field>
        </record>
        <record model="res.groups.privilege" id="module_category_openeducat">
            <field name="name">OpenEduCat</field>
            <field name="description">Helps you manage your institutes different-different users.</field>
            <field name="category_id" ref="module_category_all_openeducat"/>
            <field name="sequence">15</field>
        </record>

        <record model="res.groups.privilege" id="privilege_openeducat_others">
            <field name="name">OpenEduCat Others</field>
            <field name="description">Helps you manage your institutes different-different users.</field>
            <field name="category_id" ref="module_category_openeducat"/>
            <field name="sequence">20</field>
        </record>


        <record id="group_op_faculty" model="res.groups">
            <field name="name">User</field>
            <field name="privilege_id" ref="module_category_openeducat"/>
            <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_back_office_admin" model="res.groups">
            <field name="name">Manager</field>
            <field name="privilege_id" ref="module_category_openeducat"/>
            <field name="user_ids" eval="[(4, ref('base.user_admin'))]"/>
            <field name="implied_ids"
                   eval="[(4, ref('base.group_system')),(4, ref('openeducat_core.group_op_faculty')),(4, ref('base.group_partner_manager'))]"/>
        </record>


        <record model="ir.rule" id="student_login_rule">
            <field name="name">Student Login rule</field>
            <field name="model_id" ref="model_op_student"/>
            <field name="groups"
                   eval="[(4, ref('openeducat_core.group_op_back_office_admin'))]"/>
            <field name="domain_force">[('user_id','=',user.id)]</field>
        </record>

        <record model="ir.rule" id="view_students_rule">
            <field name="name">View Students</field>
            <field name="model_id" ref="model_op_student"/>
            <field name="groups"
                   eval="[(4, ref('openeducat_core.group_op_faculty'))]"/>
            <field name="domain_force">[(1,'=',1)]</field>
        </record>

        <record model="ir.rule" id="faculty_login_rule">
            <field name="name">Faculty Login rule</field>
            <field name="model_id" ref="model_op_faculty"/>
            <field name="groups"
                   eval="[(4, ref('openeducat_core.group_op_faculty'))]"/>
            <field name="domain_force">['|',('user_id','=',user.id),('emp_id.user_id','=',user.id)]</field>
        </record>

        <record model="ir.rule" id="view_faculty_rule">
            <field name="name">View Faculties</field>
            <field name="model_id" ref="model_op_faculty"/>
            <field name="groups"
                   eval="[(4, ref('openeducat_core.group_op_back_office_admin'))]"/>
            <field name="domain_force">[(1,'=',1)]</field>
        </record>

        <record model="ir.rule" id="student_subject_registration_rule">
            <field name="name">Student Subject Registration Rule</field>
            <field name="model_id" ref="model_op_subject_registration"/>
            <field name="groups"
                   eval="[(4, ref('openeducat_core.group_op_back_office_admin'))]"/>
            <field name="domain_force">['|', ('student_id.user_id','=',user.id), ('student_id.user_id','in',
                user.child_ids.ids)]
            </field>
        </record>

        <record model="ir.rule" id="view_all_subject_registration_rule">
            <field name="name">View Students Registration</field>
            <field name="model_id" ref="model_op_subject_registration"/>
            <field name="groups"
                   eval="[(4, ref('openeducat_core.group_op_faculty'))]"/>
            <field name="domain_force">[(1,'=',1)]</field>
        </record>

        <record model="ir.rule" id="academic_term_multi_comp_rule">
            <field name="name">Academic Term multi company</field>
            <field name="model_id" ref="openeducat_core.model_op_academic_term"/>
            <field name="global" eval="True"/>
            <field name="domain_force">
                ['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id','in',user.company_ids.ids),('company_id',
                'in', company_ids)]
            </field>
        </record>

        <record model="ir.rule" id="academic_year_multi_comp_rule">
            <field name="name">Academic Year multi company</field>
            <field name="model_id" ref="openeducat_core.model_op_academic_year"/>
            <field name="global" eval="True"/>
            <field name="domain_force">
                ['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id','in',user.company_ids.ids),('company_id',
                'in', company_ids)]
            </field>
        </record>
        <record model="ir.rule" id="subject_registrationmulti_comp_rule">
            <field name="name">Subject Registration Multi Company</field>
            <field name="model_id" ref="openeducat_core.model_op_subject_registration"/>
            <field name="global" eval="True"/>
            <field name="domain_force">
                ['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id','in',user.company_ids.ids),('company_id',
                'in', company_ids)]
            </field>
        </record>
        <record model="ir.rule" id="category_multi_comp_rule">
            <field name="name">Category Multi Company</field>
            <field name="model_id" ref="openeducat_core.model_op_category"/>
            <field name="global" eval="True"/>
            <field name="domain_force">
                ['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id','in',user.company_ids.ids),('company_id',
                'in', company_ids)]
            </field>
        </record>

        <record id="base.menu_management" model="ir.ui.menu">
            <field name="group_ids" eval="[(4, ref('base.group_system')), (3, ref('openeducat_core.group_op_faculty'))]"/>
        </record>

</odoo>
