Odoo Help

0

Create dynamic tree view

By
Irawan
on 7/13/16, 1:01 AM 648 views

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

1
Nikunj Antala
On 7/13/16, 2:46 AM

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?

Irawan
on 7/13/16, 5:25 AM
0
Irawan
On 7/13/16, 5:23 AM

Thank you.

But, how to trigger that when onchange?

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 7/13/16, 1:01 AM
Seen: 648 times
Last updated: 7/13/16, 5:24 AM