1
votes

I have form view and inside it one2many relation with tree view. I want to hide or disable "do_work" button on edit mode. I noticed what I can hide button if it is not in tree view on edit mode by class="oe_edit_only". But is it possible to hide or disable it in tree view because the same class doesn't work for me?

<field name="new_line">
       <tree editable="bottom">
             <field name="name"/>
             <field name="quantity"/>
             <field name="state" invisible="1"/>
             <field name="vendor"/>
             <field name="price_unit"/>
             <button name="do_work" type="object" string="Copy"/>
     </tree>
</field>

Your advice or suggestions will be much appreciated.

2

2 Answers

0
votes

I do not know if this could work from that context but you could try:

attrs="{'invisible': [('id', '>', 0)]}"

I hope it works for you

0
votes

Class and style are ignored in tree view so there is no easy way to do it.

But you can create your own css to target the button with that name and use same css as eo_edit_only. Or you can look if there is a module for in odoo apps.