Vote count:
0
I have written a code to update my treeview according to input. it is basically working using context. My fields_view_get method is like this:
def fields_view_get(self,cr,uid,view_id=None,view_type='form',context=None, toolbar=False, submenu=False):
if context is None:
context={}
res=super(product_product,self).fields_view_get(cr,uid,view_id=view_id,view_type=view_type,context=context,toolbar=toolbar,submenu=submenu)
doc=etree.XML(res['arch'])
if context.get('parent',False):
parent=context.get('parent',False)
if parent==85: ####Vehicle
print etree.tostring(doc,pretty_print=True)
for node in doc.xpath("//field[@name='size_furn']"):
node.set('invisible','1')
res['arch']=etree.tostring(doc)
print "\n\n\n\nxml ",res['arch']
return res
Here i am updating visibility of size_furn
I have printed output on console. here is res['arch'] before change
<!-- <field name="default_code"/> -->
<field name="name" modifiers="{"required": true}"/>
<!-- ############################################################ -->
<field name="product_code" modifiers="{"readonly": true}"/>
<!-- ############################################################ -->
here is the changes on res['arch']
<!-- <field name="default_code"/> -->
<field name="name" modifiers="{"required": true}"/>
<!-- ############################################################ -->
<field name="product_code" modifiers="{"readonly": true}"/>
<!-- ############################################################ -->
As we can see xml is updating, but problem is changes are not visible on openerp application. I can view this field in any case. i tried to use True and False too. but it didnot work. any way to resolve this issue.
Thanks
asked 1 min ago
Field not hiding from tree view using Fields_view_get
Aucun commentaire:
Enregistrer un commentaire