【问题标题】:Hide Edit and delete button for each group Odoo 12隐藏每个组的编辑和删除按钮 Odoo 12
【发布时间】:2019-04-23 10:48:56
【问题描述】:

我想根据用户组隐藏编辑、创建和删除按钮。您可以编辑 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>

【问题讨论】:

    标签: xml security odoo odoo-12


    【解决方案1】:

    我会选择第一名。

    为了让它发挥作用:

    • 检查您是否正在导入 __manifest__.py (__openerp__.py) 中的 ir.model.access.csv
    • 检查您没有使用管理员用户,该用户不受影响 访问规则。

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

    【讨论】:

    • 谢谢你的帮助,当我在服务器上工作的时候显得淋漓尽致,我不明白本地有什么问题,可能是在Odoo 12版本不一样的提交?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多