Skip to Content
Menu
This question has been flagged
1 Reply
3412 Views

I would like to create a conditional field in the Inventory app where if certain documents aren't present the validate button would be invisible until those documents are uploaded. 

So far, the code we've written only executes the delivery order section. I would like to find out how to write a conditional statement that would be specific to the relevant operation type.


Here's  a look at the code written:

<data>
<xpath expr="//button[@name='do_new_transfer'][1]" position="attributes">
<attribute name="attrs">{'invisible': ['|', ('x_GRN', '=',False), '|',('x_supporting_waybill', '=',False), '|',('x_supplier_invoice', '=',False), '|',('x_LPO', '=',False), '|',('picking_type_code','!=','incoming'), '|',('state', 'not in', ('assigned', 'partially_available'))]}</attribute>
<attribute name="attrs">{'invisible': ['|', ('x_ATS', '=',False), '|',('picking_type_code','!=','internal'), '|',('state', 'not in', ('assigned', 'partially_available'))]}</attribute>
<attribute name="attrs">{'invisible': ['|', ('x_delivery_note', '=',False), '|',('picking_type_code','!=','outgoing'), '|',('state', 'not in', ('assigned', 'partially_available'))]}</attribute>
</xpath>
</data>


is this correct what do I need to do to fix it




Avatar
Discard
Best Answer

<field name="field name" attrs="{'invisible': [(field name ', '=', False)]}"/>

You can try this just replace field name with your field and change the condition based on your requirements . this will work.

Thanks.

Avatar
Discard