pythonxmlodooodoo-17

Hide buttons in odoo 17


I want to add a validation to hide the credit notes button in certain areas of the code, to be exact in the movements with the “factura_especial” field, but when using this code, the button is hidden everywhere, even customer invoices (out_invoice).

<xpath expr="//button[@name='action_reverse']" position="attributes">
  <attribute name="invisible">[("factura_especial","=",True)]</attribute>
</xpath>

I want the button to be hidden only on invoices that are “factura_especial”.


Solution

  • a domain is no longer placed in the invisible attribute. You can place the invisible one like this:

    <attribute name="invisible">factura_especial</attribute>
    

    which is the same as

    <attribute name="invisible">factura_especial != False</attribute>
    

    Remember to place the factura_especial field in the view so that you don't get an error