Search code examples
pythonodoo-8odoo

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?


Solution

  • 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)], }"/>