我想根据用户组隐藏编辑、创建和删除按钮。您可以编辑 ir.model.access.csv我尝试了所有的道路,但没有成功:
第1期 :
hr.access_hr_department_user, hr.department.user, model_hr_Department, hr.group_hr_user, 1,0,0,0
第2号:
<record model="ir.ui.view" id="view_hr_department_form_groups_section">
<field name="name">edit_button</field>
<field name="model">hr.department</field>
<field name="inherit_id" ref="hr.view_department_form"/>
<field name="groups_id" eval="[(4,ref('security_groups.group_supervisor_department') )]"/>
<field name="arch" type="xml">
<xpath expr="/form" position="attributes">
<attribute name="create">false</attribute>
<attribute name="edit">false</attribute>
</xpath>
</field>
</record>
解决方案N°2所有组的隐藏按钮
第3号:
<record model="ir.ui.view" id="view_hr_department_form_groups_section">
<field name="name">edit_button</field>
<field name="model">hr.department</field>
<field name="inherit_id" ref="hr.view_department_form"/>
<field name="groups_id" eval="[(4,ref('security_groups.group_supervisor_department') )]"/>
<field name="arch" type="xml">
<form create= 'false' editable ='false' >
</form>
</field>
</record>
我会选择1号。
要使其正常工作:
- 检查是否正在导入 ir.model.access.csv 在__manifest__.py (__openerp__.py( 中
- 检查您没有使用管理员用户,该用户不受影响通过访问规则。
如果它不起作用,请分享ir.model.access.csv