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.

1

How to add fields in Listview from fields_view_get?

By
Viraj Joshi
on 1/13/15, 9:05 AM 635 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.

2

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

deep
On 1/14/15, 10:26 AM

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

 


 

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!

bernscheinder
on 2/27/15, 9:36 AM

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: 1/13/15, 9:05 AM
Seen: 635 times
Last updated: 5/21/16, 3:32 AM