Odoo Help


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 642 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

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.


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)


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