隐藏每个组的“编辑和删除”按钮Odoo 12

时间:2019-04-23 10:48:56

标签: xml security odoo odoo-12

我想隐藏基于用户组的编辑,创建和删除按钮。您可以编辑ir.model.access.csv 我尝试了所有道路,但没有成功:

n°1:

hr.access_hr_department_user, hr.department.user, model_hr_Department, hr.group_hr_user, 1,0,0,0

n°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隐藏按钮

n°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 个答案:

答案 0 :(得分:0)

我会选择1号。

要使其正常工作:

  • 检查是否在 __ manifest __。py __ openerp __。py
  • 中导入ir.model.access.csv。
  • 检查您是否未使用管理员用户,该用户是否不受影响 根据访问规则。

如果它不起作用,请共享ir.model.access.csv

相关问题