目的:让编辑/创建按钮只出现在用户组:Manager
模块名称: Simcard
型号名称:simcard_simcard
我的 csv 文件:
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
demo_admin, Model admin access,model_simcard_simcard,simcard.group_manager,1,1,1,1
demo_user, Model user access,model_simcard_simcard,simcard.group_user,0,0,0,0
我的 user_groups.xml :
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record model="ir.module.category" id="module_management">
<field name="name">Simcard</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="simcard.module_management"/>
</record>
<record id="group_manager" model="res.groups">
<field name="name">Manager</field>
<field name="implied_ids" eval="[(4, ref('simcard.group_user'))]"/>
<field name="category_id" ref="simcard.module_management"/>
</record>
</data>
</odoo>
我的 views.xml :
<record id="remove_edit" model="ir.ui.view">
<field name="name">remove.edit</field>
<field name="model">simcard.simcard</field>
<field name="inherit_id" ref="simcard.view_sim_form"/>
<!-- <field name="groups_id" eval="[(4, [ref('simcard.group_manager')])]"/> -->
<field name="arch" type="xml">
<xpath expr="//form" position="attributes">
<attribute name="edit">true</attribute>
<attribute name="groups">simcard.group_manager</attribute>
</xpath>
</field>
</record>
普通用户仍会显示此编辑按钮。
holdtom
相关分类