I have a small question, just to research. I can hide a field based on attrs in odoo 8, but is there a way to do the same in python code. below is the code:
<field name="test" attrs="{'invisible':[('role', '=', 'testrole')]}" />
so this does the work ( means hides the field if field name role has value 'test role' ) Then i tried to achieve same functionality using python with method onchange on role field as below:
<field name="role" on_change="hide(role)"/>
in my model :
def hide(self,cr,uid,ids,role) :
res = {'value':{}}
if role == 'testrole':
res['value']['test']['attrs']['invisible']=True
return res
But this does not work, Any suggestions ?
Thanks,