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

    <!-- Note using code overriding menu in code (not working) so these below features will add using ODOO UI -->

     <!--<record id="group_show_hr_discuss_group" model="res.groups">
        <field name="name">Show Discuss Menu</field>
        <field name="comment">Show Discuss Menu related user group</field>
    </record>

     <record id="group_show_hr_contact_group" model="res.groups">
        <field name="name">Show Contact Menu</field>
        <field name="comment">Show Contact Menu related user group</field>
        <field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
    </record>

    <record id="group_show_hr_menu_group" model="res.groups">
        <field name="name">Show HR Menu</field>
        <field name="comment">Show HR Menu related user group</field>
        <field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
    </record>-->

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

   <!-- <record id="group_project_cor_admin" model="res.groups">
        <field name="name">Cor Custom</field>
        <field name="category_id" ref="base.module_category_services_project"/>
        <field name="implied_ids" eval="[(4, ref('project.group_project_manager'))]"/>
        <field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
    </record> -->


    <function name="write" model="ir.model.data">
        <function name="search" model="ir.model.data">
            <value eval="[('module','=','hr_timesheet'),('name','=','timesheet_line_rule_user')]"/>
        </function>
        <value eval="{'noupdate': False}" />
    </function>


    <record id="hr_timesheet.timesheet_line_rule_user" model="ir.rule">
        <field name="name">account.analytic.line.timesheet.user</field>
        <field name="model_id" ref="analytic.model_account_analytic_line"/>
        <field name="domain_force">[
            ('user_id', '=', user.id),
            ('project_id', '!=', False),
            '|', '|','|',
                ('project_id.privacy_visibility', '!=', 'followers'),
                ('project_id.allowed_internal_user_ids', 'in', user.ids),
                ('task_id.allowed_user_ids', 'in', user.ids),
                ('project_id.sale_line_employee_ids.employee_id.user_id', 'in', user.ids),

        ]</field>
        <field name="groups" eval="[(4, ref('hr_timesheet.group_hr_timesheet_user'))]"/>
    </record>


    <function name="write" model="ir.model.data">
        <function name="search" model="ir.model.data">
            <value eval="[('module','=','hr_timesheet'),('name','=','timesheet_line_rule_approver')]"/>
        </function>
        <value eval="{'noupdate': False}" />
    </function>

    <record id="hr_timesheet.timesheet_line_rule_approver" model="ir.rule">
        <field name="name">account.analytic.line.timesheet.approver</field>
        <field name="model_id" ref="analytic.model_account_analytic_line" />
        <field name="domain_force">[
            ('project_id', '!=', False),
            '|','|',
                ('project_id.privacy_visibility', '!=', 'followers'),
                ('project_id.allowed_internal_user_ids', 'in', user.ids),
                ('project_id.sale_line_employee_ids.employee_id.user_id', 'in', user.ids),
        ]</field>
        <field name="groups" eval="[(4, ref('hr_timesheet.group_hr_timesheet_approver'))]" />
    </record>

    <!-- <function name="write" model="ir.model.data">
        <function name="search" model="ir.model.data">
            <value eval="[('module','=','project'),('name','=','project_project_manager_rule')]"/>
        </function>
        <value eval="{'noupdate': False}" />
    </function>

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

     <function name="write" model="ir.model.data">
        <function name="search" model="ir.model.data">
            <value eval="[('module','=','project'),('name','=','project_manager_all_project_tasks_rule')]"/>
        </function>
        <value eval="{'noupdate': False}" />
    </function>


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

   <!-- <record model="ir.rule" id="project_project_all_admin_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('group_project_cor_admin'))]"/>
    </record>

    <record model="ir.rule" id="project_project_all_project_tasks_admin_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('group_project_cor_admin'))]"/>
    </record> -->

    <record model="ir.rule" id="project_view_consultant_user_own_rule">
        <field name="name">Project: view Consultant: Own User</field>
        <field name="model_id" ref="model_project_consultant_hrs_report"/>
        <field name="domain_force">[('employee_id.user_id', '=', user.id)]</field>
        <field name="groups" eval="[(4,ref('project.group_project_user'))]"/>
    </record>

    <record model="ir.rule" id="project_view_consultant_manager_rrule">
        <field name="name">Project: view Consultant: Manager User</field>
        <field name="model_id" ref="model_project_consultant_hrs_report"/>
        <field name="domain_force">[(1,'=',1)]</field>
        <field name="groups" eval="[(4,ref('project.group_project_manager'))]"/>
    </record>

   <!-- [('project_id.user_id','=',user.id)]
    <record model="ir.rule" id="project_view_consultant_admin_rrule">
        <field name="name">Project: view Consultant: all User</field>
        <field name="model_id" ref="model_project_consultant_hrs_report"/>
        <field name="domain_force">[(1,'=',1)]</field>
        <field name="groups" eval="[(4,ref('group_project_cor_admin'))]"/>
    </record>-->

</odoo>
