Python – How to hide buttons in Odoo’s creation mode

How to hide buttons in Odoo’s creation mode… here is a solution to the problem.

How to hide buttons in Odoo’s creation mode

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

But how do you hide the button when creating a project (and show it only after the project is created, whether in read or edit mode)? I tried to look at the base.css file but didn’t find its class.

Is there a built-in CSS class? OR IS THERE A FUNCTION IN QWEB FOR THIS PURPOSE?

Solution

If you are creating a method, you have not stored the ID in the database. So you can do this:

<pre class=”lang-py prettyprint-override”><field name="id" invisible="True"/>
<button attrs="{'invisible': [('id', '=', False)], }"/>

Related Problems and Solutions