简体   繁体   中英

How to hide button on create mode in Odoo

I know I can hide form button using built-in css class like oe_edit_only or oe_read_only

But how to hide an button when creating an item (and show the button only after the item is created, regardless when at read or edit mode)? I tried to look at the base.css file and found no class for this.

Is there a built-in css class for this? Or is there a function in the QWEB for this?

If you are creating the method you don't have the id stored in the database yet. So you can do something like this:

<field name="id" invisible="True"/>
<button attrs="{'invisible': [('id', '=', False)], }"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM