我正在尝试创建安全组,因此菜单项只能由特定用户组访问。
我的模块名称是:school
我的型号名称是:school
我的学校/安全/ ir.model.access.csv 档案:
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
school_admin,school.admin.access,model_school,school.group_manager,1,1,1,1
school_user, school.user.access,model_school,school.group_user,1,0,0,0
我的学校/安全/ security.xml 文件:
<odoo>
<data noupdate="1">
<record model="ir.module.category" id="module_management">
<field name="name">Demo access</field>
<field name="description">User access level for this module</field>
<field name="sequence">3</field>
</record>
<record id="group_user" model="res.groups">
<field name="name">User</field>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
<field name="category_id" ref="school.module_management"/>
</record>
<record id="group_manager" model="res.groups">
<field name="name">Manager</field>
<field name="implied_ids" eval="[(4, ref('school.group_user'))]"/>
<field name="category_id" ref="school.module_management"/>
</record>
</data>
我的菜单:
第一个菜单项应仅对用户group_manager可见,而第二个菜单项应仅对用户group_user可见。
<menuitem action="action_view_school" id="school_details" sequence="1" name="View All details" parent="menu_school" groups="school.group_manager"/>
<menuitem action="action_view_school_teachers" id="menu_teachers" sequence="2" name="View teachers" parent="menu_school" groups="school.group_user"></menuitem>
这是我得到的错误:
No matching record found for external id 'school.group_manager' in field 'Group'
No matching record found for external id 'school.group_user' in field 'Group'
注意:我已经在_manifest.py文件中添加了文件。但仍然得到错误。