Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to return models and ids of the user's in OpenERP?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 382
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: