Basic idea: Hide few fields in client form view for OpenERP users which are not defined as VIP users in my custom many2many table (user_id, partner_id)
What I've already done:
In res.partner form view:
<field name="vip_ids" widget="many2many_tags" placeholder="VIP users..."/>
My custom module which adds many2many relationship for res.partner module:
from openerp.osv import orm, fields
from osv import fields, osv
class res_partner_users_vip_rel2(osv.osv):
_inherit = 'res.partner'
_description = "VIP status for partner (users)"
_columns = {
'vip_ids': fields.many2many(
'res.users',
'res_partner_users_vip_rel2',
'partner_id',
'users_id',
'VIP status'),
}
res_partner_users_vip_rel2()
In Form View I can successfully save multiple users in newly created field, but I am stuck at hiding other fields for users who are not defined in my many2many relationship.
As I understand, I need to use attrs attribute but I don't understand how to use it with many2many relationship.
This doesn't work:
<field name="mobile" attrs="{'invisible': [('uid','in', vip_ids)]}"/>
<field name="fax" attrs="{'invisible': [('uid','in', vip_ids)]}"/>
<field name="email" widget="email" attrs="{'invisible': [('uid','in', vip_ids)]}"/>
Any advice would be greatly appreciated :)