<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">

    <record id="group_project_user" model="res.groups">
        <field name="name">User</field>
        <field name="category_id" ref="base.module_category_project_management"/>
    </record>

    <record id="group_project_manager" model="res.groups">
        <field name="name">Manager</field>
        <field name="category_id" ref="base.module_category_project_management"/>
        <field name="implied_ids" eval="[(4, ref('group_project_user'))]"/>
        <field name="users" eval="[(4, ref('base.user_root'))]"/>
    </record>

    <record model="ir.ui.menu" id="base.menu_definitions">
        <field name="groups_id" eval="[(6,0,[ref('group_project_manager')])]"/>
    </record>

    <record id="group_tasks_work_on_tasks" model="res.groups">
        <field name="name">Task's Work on Tasks</field>
        <field name="category_id" ref="base.module_category_hidden"/>
    </record>
    
    <record id="group_time_work_estimation_tasks" model="res.groups">
        <field name="name">Time Estimation on Tasks</field>
        <field name="implied_ids" eval="[(4, ref('group_tasks_work_on_tasks'))]"/>
        <field name="category_id" ref="base.module_category_hidden"/>
    </record>

    <record id="group_delegate_task" model="res.groups">
        <field name="name">Task Delegation</field>
        <field name="category_id" ref="base.module_category_hidden"/>
    </record>

</data>
<data noupdate="1">

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

    <record model="ir.rule" id="project_project_manager_rule">
        <field name="name">Project: project manager: see all</field>
        <field name="model_id" ref="model_project_project"/>
        <field name="domain_force">[(1, '=', 1)]</field>
        <field name="groups" eval="[(4,ref('project.group_project_manager'))]"/>
    </record>

    <record model="ir.rule" id="project_public_members_rule">
        <field name="name">Project: employees: public, employees or followers</field>
        <field name="model_id" ref="model_project_project"/>
        <field name="domain_force">['|',
                                        ('privacy_visibility', 'in', ['public', 'employees']),
                                        ('message_follower_ids', 'in', [user.partner_id.id])
                                    ]</field>
        <field name="groups" eval="[(4, ref('base.group_user'))]"/>
    </record>

    <record model="ir.rule" id="task_comp_rule">
        <field name="name">Project/Task: multi-company</field>
        <field name="model_id" ref="model_project_task"/>
        <field name="global" eval="True"/>
        <field name="domain_force">['|',
                                        ('company_id', '=', False),
                                        ('company_id', 'child_of', [user.company_id.id]),
                                    ]</field>
    </record>

    <record model="ir.rule" id="task_visibility_rule">
        <field name="name">Project/Task: employees: public or employee or following or assigned</field>
        <field name="model_id" ref="model_project_task"/>
        <field name="domain_force">['|',
                                        ('user_id', '=', user.id),
                                        '|',
                                            ('project_id.privacy_visibility', 'in', ['public', 'employees']),
                                            '&amp;',
                                                ('project_id.privacy_visibility', '=', 'followers'),
                                                ('message_follower_ids', 'in', [user.partner_id.id]),
                                    ]</field>
        <field name="groups" eval="[(4,ref('base.group_user'))]"/>
    </record>

    <record model="ir.rule" id="project_manager_all_project_tasks_rule">
        <field name="name">Project/Task: project manager: see all</field>
        <field name="model_id" ref="model_project_task"/>
        <field name="domain_force">[(1, '=', 1)]</field>
        <field name="groups" eval="[(4,ref('project.group_project_manager'))]"/>
    </record>

</data>
</openerp>
