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

How to manipulate the view.xml with specific id using fields_view_get?

By
Abegail Sanchez
on 10/29/14, 9:29 PM 669 views

This is the view I want to achieve:

I want that view_id product_location_view_tree only use that view, this view is working

but It affect all the tree view of the product_product model

def fields_view_get(self,cr,uid,view_id='product_location_view_tree',view_type='tree',context=None,toolbar=None,submenu=None):
        res=super(product_location,self).fields_view_get(cr,uid,view_id,view_type,context,toolbar,submenu)
        _moves_fields = res['fields']
        _moves_arch_lst=''
        if res['type'] == 'tree':
            tree_arch=res['arch']
            _moves_arch_lst=tree_arch[:tree_arch.find('</tree>')]
            for key,value in self._format_columns(cr).items():
                
                _moves_fields.update({value : {'string':key,'type': 'float',},})
                _moves_arch_lst += """<field name='%s'/>"""%value    
            _moves_arch_lst += """</tree>"""
            res['arch']=_moves_arch_lst
        return res

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: 10/29/14, 9:29 PM
Seen: 669 times
Last updated: 3/16/15, 8:10 AM