跳至內容
選單
此問題已被標幟
3 回覆
9440 瀏覽次數

How to create dynamic tree view? or hidden field in tree view?

頭像
捨棄
最佳答案

Hello Irawan,

You can create dynamic tree view using fields_view_get method.


Example:

    from lxml import etree

     @api.model

        def fields_view_get(self, view_id=None, view_type=’tree’, context=None, toolbar=False,submenu=False): 

        result = super(model_name,self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)

        doc = etree.XML(result[‘arch’])

        if new_string:

        for node in doc.xpath(“//field[@name=’field_a’]”):

            node.set(‘string’, new_string)

        result[‘arch’] = etree.tostring(doc)

        return result


Hope this help.

頭像
捨棄
作者

Thank you.

But, how to trigger that when onchange?

最佳答案

HI, you can follow following tutorial for this:

https://youtu.be/kwkddYoFQCE

Hope it helps,

Thanks

頭像
捨棄
作者 最佳答案

Thank you.

But, how to trigger that when onchange?

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
3
4月 25
4628
5
11月 23
42950
1
9月 22
3706
1
6月 22
12543
3
3月 20
11008