<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
     License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
<odoo>

<data noupdate="0">

    <record model="ir.module.category" id="module_category_mrp_production_request">
        <field name="name">Manufacturing Request</field>
        <field name="parent_id" ref="base.module_category_manufacturing"/>
        <field name="sequence">20</field>
    </record>

    <record id="group_mrp_production_request_user" model="res.groups">
        <field name="name">User</field>
        <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
        <field name="category_id" ref="module_category_mrp_production_request"/>
    </record>

    <record id="group_mrp_production_request_manager" model="res.groups">
        <field name="name">Manager</field>
        <field name="implied_ids"
               eval="[(4, ref('mrp_production_request.group_mrp_production_request_user'))]"/>
        <field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
        <field name="category_id" ref="module_category_mrp_production_request"/>
    </record>

</data>
<data noupdate="0">

    <record model="ir.rule" id="mrp_production_request_comp_rule">
        <field name="name">Manufacturing Request multi-company</field>
        <field name="model_id" ref="model_mrp_production_request"/>
        <field name="global" eval="True"/>
        <field name="domain_force">['|',('company_id','=',False),
            ('company_id','child_of',[user.company_id.id])]</field>
    </record>

    <record id="mrp_production_request_followers_rule" model="ir.rule">
        <field name="name">Follow Manufacturing Request</field>
        <field name="model_id" ref="model_mrp_production_request"/>
        <field name="groups" eval="[(6,0, [ref('group_mrp_production_request_user')])]"/>
        <field name="perm_read" eval="True"/>
        <field name="perm_write" eval="False"/>
        <field name="perm_create" eval="False"/>
        <field name="perm_unlink" eval="False"/>
        <field name="domain_force">['|',('requested_by','=',user.id),
                                        ('message_partner_ids', 'in', [user.partner_id.id])]</field>
    </record>

    <record id="mrp_production_request_rule" model="ir.rule">
        <field name="name">Manufacturing Request User</field>
        <field name="model_id" ref="model_mrp_production_request"/>
        <field name="groups" eval="[(6,0, [ref('group_mrp_production_request_user')])]"/>
        <field name="perm_read" eval="True"/>
        <field name="perm_write" eval="True"/>
        <field name="perm_create" eval="True"/>
        <field name="perm_unlink" eval="True"/>
        <field name="domain_force">[('requested_by','=',user.id)]</field>
    </record>

    <record id="mpr_production_request_line_manager_rule" model="ir.rule">
        <field name="name">Manufacturing Request Line Manager</field>
        <field name="model_id" ref="model_mrp_production_request"/>
        <field name="groups" eval="[(6,0, [ref('group_mrp_production_request_manager')])]"/>
        <field name="perm_read" eval="True"/>
        <field name="perm_write" eval="True"/>
        <field name="perm_create" eval="True"/>
        <field name="perm_unlink" eval="True"/>
    </record>

</data>
</odoo>
