How to hide or disable “Edit” button in Odoo 9

試著忘記壹切 提交于 2019-12-11 06:24:53

问题


Can anyone help me how to hide or disable Edit and/or Create button when my workflow status value is "Done"

I have workflow status "Draft > Approval > Confirmed > Done"

so when status is Done i want 'Edit' to be hidden or disabled.

Please help. thanks in advance.


回答1:


You should be able to create a security rule which restricts write access when the status is done. Something like this. If you have a group you wish to specify then select it. If you have no group I am not sure however you may be able to either leave this field out or place an empty array to represent all groups.

    <record id="no_edit_when_done" model="ir.rule">
        <field name="name">No Edit When Done</field>
        <field name="model_id" ref="model_youraddon_yourmodel"/>
        <field name="groups" eval="[(4, ref('base.group_user'))]"/>
        <field name="perm_read" eval="1"/>
        <field name="perm_write" eval="0"/>
        <field name="perm_create" eval="0"/>
        <field name="perm_unlink" eval="0"/>
        <field name="domain_force">
            [('status','=','done')]
        </field>
    </record>


来源:https://stackoverflow.com/questions/40071622/how-to-hide-or-disable-edit-button-in-odoo-9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!