Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
9444 มุมมอง

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?

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
3
เม.ย. 25
4639
5
พ.ย. 23
42955
1
ก.ย. 22
3716
1
มิ.ย. 22
12544
3
มี.ค. 20
11012