This question has been flagged
1 Reply
4043 Views

Hello,

I want to add fields in listview from fields_view_get method, as well as wants to fill up data for these fields.

I have data and fields in dictionary.

I got some help to update attributes of fields, but I want more than this.

from lxml import etree

arch = etree.XML(res['arch'])

for node in arch.xpath("//field[@name='code']"):

        node.set('readonly', '1')

res['arch'] = etree.tostring(arch)

But I want to add new fields (dynamically n numbers of field) using code.

Can any one help me ?

Thanks in advance.

Avatar
Discard
Best Answer

You can do it in 2 ways:

One best way to do is... add all fields in the Tree View, with invisible property, then in fields_view_get change the invisible property based on your requirement..

Other One: In fields_view_get redefining your entrie Tree View dynamically... OR have different views, and call the respective view in this method

 


 

Avatar
Discard

Hi deep, thw for your answer but my problem is that the part of the view is dynamic. I have a field name "type" and on_change of type value some fields is invisible or no!! how to manage it please! I've already used the function on_change and redefine res['arch'] in this function but it is not work!