In OpenERP first we create user's in user's form. Then the access of user's models res_users and pass the ids of the user's. After passing ids of the user's then user's selection will active and Return a tuple.
Use this function given below
def select_users(self, cr, uid, context=None):
res = False
me = self.pool.get('res.users').read(
cr, uid, uid, ['saved_selection_id'], context=context)
if me['saved_selection_id']:
selection_id = me['saved_selection_id'][0]
selection = self.read(
cr, uid, selection_id, ['model_id', 'ids'], context)
model = self.pool.get('ir.model').read(
cr, uid, selection['model_id'][0], ['model'], context
)['model']
domain = [('id', 'in', (
selection['ids'] and
[int(x) for x in selection['ids'].split(',')] or []))]
search_context = context and context.copy() or {}
search_context['active_test'] = False
ids = self.pool.get(model).search(
cr, uid, domain, limit=0, context=search_context)
res = (model, ids)
return res
0 Comment(s)