I have created Record Rule that only employee can see the project for odoo11

600 Views Asked by At

I have created Record Rule that only employee can see the project which they have to assign but my code is not working I am beginner for odoo and its for odoo 11.

Please help me out.


XML Code

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

<odoo>
<data noupdate="1">


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

 <record model="ir.rule" id="project_members_rule">
             <field name="name">Project: User is Member</field>
             <field name="model_id" ref="model_project_task"></field>
             <field name="groups" eval="[(4,ref('project.task.group_project_employee'))]"></field>
             <field name="domain_force">['|',('user_id','=',False),('user_id','=',user.id)]</field>
             <field eval="1" name="perm_read"></field>   
             <field eval="0" name="perm_write"></field> 
             <field eval="0" name="perm_unlink"></field>
             <field eval="0" name="perm_create"></field>
     </record>    
</data>
</odoo>

Python Code

from odoo import api, fields, models, _

class ProjectTask(models.Model):    

     _inherit = 'project.project'

     employee_user = fields.Many2many('res.users', 'project_user_rel', 'project_id',
                               'uid', 'Team', help="""Project's
                               members are users who can have an access to
                               the tasks related to this project."""
                               )

CSV

  id    name    model_id:id group_id:id perm_read   perm_write  perm_create perm_unlink

  access_project_task   project.task    model_project_task  project.group_project_employee  1   0   0   0

Thanks in advance.

1

There are 1 best solutions below

0
On

Problem is that you are giving him group_user means employee and there is some records rules written for him in project you have to modify them too.