This question has been flagged
2086 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

Avatar
Discard