Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create users in login form in OpenERp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 429
    Comment on it

    In OpenERP first create the users and then users is retrieve an active resource of model res_users with the specified login. When users login in web page then verify all the rights and authentication. If users rights and authentication both is fine then users is login successfully in web pages.
    Use this function given below

    def createuser(self, cr, uid, conf, login, ldap_entry,
                               context=None):
       
            user_id = False
            login = tools.ustr(login)
            cr.execute("SELECT id, active FROM res_users WHERE login=%s", (login,))
            res = cr.fetchone()
            if res:
                if res[1]:
                    user_id = res[0]
            elif conf['create_user']:
                logger = logging.getLogger('orm.ldap')
                logger.debug("Creating new OpenERP user \"%s\" from LDAP" % login)
                user_obj = self.pool.get('res.users')
                values = self.map_ldap_attributes(cr, uid, conf, login, ldap_entry)
                if conf['user']:
                    user_id = user_obj.copy(cr, SUPERUSER_ID, conf['user'],
                                            default={'active': True})
                    user_obj.write(cr, SUPERUSER_ID, user_id, values)
                else:
                    user_id = user_obj.create(cr, SUPERUSER_ID, values)
            return user_id

     

 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: