Odoo Help

Welcome!

This community 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.

0

Create dynamic tree view

By
Irawan
on 7/13/16, 1:01 AM 279 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?

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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