attrs={'invisible'} on field tags doesn't work in fields_view_get method!

Bug #1390117 reported by heba
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo GTK Client (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

I am working on openerp v.7. I override fields_view_get function and create in it many2one field as following:
result['arch']= '''<field name= "hw_sub_category" attrs="{'invisible': [('state','=','initial')]}"/> '''

The field is added successfully but it always visible.

I guessed that because may be attrs invisible doesn't work on the field tag in fields_view_get function so I set the field under group and add the attrs to the group as following:

_arch_moves += '''<group attrs="{'invisible': [('state','=','initial')]}">'''
_arch_moves += '''<field name= "hw_sub_category"/> '''
_arch_moves += '''</group>'''
result['arch']= _arch_moves

but also the same thing the field is always visible.

I tried also to set the invisible in the fields.update itself as following:
result['fields'].update({'hw_sub_category': {'string': 'Hardware subcategory', 'type': 'many2one','relation':'dynamic.fields', 'invisible':True}})

By searching I found the following way:
 doc = etree.XML(result['arch'])
  for node in doc.xpath("//field[@name='hw_sub_category']"):
      node.set('invisible', '1')
  result['arch'] = etree.tostring(doc)

Also The field always visible.

So why the invisible attribute doesn't work in the fields_view_get method and how can I overcome this?

Thanks in advance.

heba (hebatuallah-fahmy)
summary: - invisible attribute doesn't work in fields_view_get method
+ attrs={'invisible'} on field tags doesn't work in fields_view_get
+ method!
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.