2015-08-16 2 views
1

Je veux ajouter un bouton à une arborescence et je veux le rendre invisible lorsque le purchase_line_id est NULL.Comment rendre un bouton invisible sous certaines conditions sur une vue Odoo?

Comment puis-je faire cela? Voici mon code d'héritage de vue.

<record id="view_move_pickingextended_tree" model="ir.ui.view"> 
      <field name="name">stock.move.tree.extended</field> 
      <field name="model">stock.move</field> 
      <field name="inherit_id" ref="stock.view_move_picking_tree"/> 
      <field name="arch" type="xml"> 
       <xpath expr="//field[@name='state']" position="after"> 
        <button name="%(uom_conv_trans_level_thura)d" string="Manual Pick" 
          type="action" class="oe_highlight" icon="fa-book" 
          context="{'product_id':product_id}" invisible="context.get('purchase_line_id',False)"/> 
      </xpath> 
     </field> 
    </record> 
+0

Ce champ est uniquement dans le contexte? – ChesuCR

Répondre

1

Essayez juste

<button name="%(uom_conv_trans_level_thura)d" string="Manual Pick" 
     type="action" class="oe_highlight" icon="fa-book" 
     context="{'product_id':product_id}" 
     attrs="{'invisible': [('purchase_line_id', '=', False)]}" />