1

我创建了记录规则,只有员工才能看到他们必须分配的项目,但我的代码不起作用我是 odoo 的初学者,它适用于 odoo 11。

请帮帮我。


XML 代码

<?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代码

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

提前致谢。

4

1 回答 1

0

问题是你给他 group_user 意味着员工,并且在项目中为他编写了一些记录规则,你也必须修改它们。

于 2018-12-19T08:49:10.583 回答