Odoo Help


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.


Why setting inline attributes in fields are different when using the fields_view_get method approach

Abegail Sanchez
on 7/31/14, 9:59 PM 355 views

This actually hide the column:

<field name="primary_shop_id" string="Main Shop"  invisible="1" />
 <field name="secondary_shop_id" string="Secondary Shop" invisible="1" />

But this only hide the value of the column:

def fields_view_get(self, cr, uid, view_id=None, view_type='tree', context=None, toolbar=False, submenu=False):
        res = super(hospital_account_lines, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type,context=context, toolbar=toolbar, submenu=submenu)
        if res['type'] == 'tree':
            doc = etree.XML(res['arch'])
            for field_name in self._columns.keys(): #@ can be res['fields'].keys() ,just fields in view
                if field_name == 'primary_shop_id' or field_name == 'secondary_shop_id' :
                    for node in doc.xpath("//field[@name='"+field_name+"']"):
                            node.set('invisible', "1")
                            setup_modifiers(node, res['fields'][field_name])
            res['arch'] = etree.tostring(doc)           
        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)


Asked: 7/31/14, 9:59 PM
Seen: 355 times
Last updated: 3/16/15, 8:10 AM