Hello, what I need is to set a certain field invisible or visible depending on a many2one field selection. The problem is i cant do it in xml, I need to do it in python code, using the on_change method that is called whenever my many2one field changes. What i dont know how to do, is to set the field to invisible or visible?
On the other hand i could do it in xml, but i cant figure out how to make it work. This is my current code in xml:
Code:
<field name="currency_it" string="Currency" />
<field name="amount" attrs="{'invisible':[('currency_id','!=',company_id.currency_id)]}"/>
But it just doesnt do anything. Help please!!! Any solution would do. thanks
An idea is to create a boolean field and set that boolean field True based on your desired condition. And use that boolean field in XML to dynamically visible and invisible fields.
Have a look in code: http://learnopenerp.blogspot.com/2016/10/how-to-visible-and-invisible-fields-in.html