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

    <record id="group_project_user" model="res.groups">
        <field name="name">Project / User</field>
    </record>

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

    <record id="base.group_sale_salesman" model="res.groups">
        <field name="name">Sales / User</field>
    </record>

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

    <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="task_comp_rule">
        <field name="name" >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" >Tasks According to User and Project</field>
        <field name="model_id" ref="model_project_task"/>
        <field name="global" eval="True"/>
        <field name="domain_force">['|','|','|',('user_id','=',False),('user_id','=',user.id),('project_id.members','in', [user.id]),('project_id.user_id','=',user.id)]</field>
        <field name="groups" eval="[(4,ref('project.group_project_user'))]"/>
    </record>

    <record model="ir.rule" id="project_manager_all_project_tasks_rule">
        <field name="name">Project Managers: all tasks from all projects</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>
