Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

3

How to pass connection parameters in the URL ?

By
semah
on 11/14/13, 8:39 AM 8,991 views

I am working with OpenERP 7. I want to know how can I log in the server by just passing connection parameters in the URL (db, login, password).

Any idea how can we do that ?

Hi, did you find the solution? I'm trying to do the same...

Versão Integral, Anabela Damas
on 12/16/13, 8:23 AM

not found yet

semah
on 12/16/13, 2:34 PM

I have this question too: http://help.openerp.com/question/39187/how-to-pass-login-and-password-parameters-to-user/ I will try do do this. If I have positive results I will share with you.

Versão Integral, Anabela Damas
on 12/17/13, 5:50 AM
3
Krishna
On 4/1/14, 4:44 AM

Here is the URL string for seamless login from another page to openerp.

localhost:8069/login?db=nas&login=&key=

This is working. Thanks Krishna

vimal j
on 4/1/14, 5:38 AM

This works only if you have a single database in your server : add another database (nas2 for example) and try to connect to it .It will not work !!!

semah
on 4/18/14, 8:10 AM

It will work. You have to select nas2 database first..

Krishna
on 4/18/14, 8:19 AM

I will connect to my OpenERP server from another website, it means that l WILL NOT not use the default login page so how can I select the database which I want to connect to

semah
on 4/18/14, 11:09 AM
1
Alcaline
On 10/19/14, 10:37 PM

hi

Do you have any idea how to restrict the login process? I want to disable the login process in openerp after working hours. any idea how to do that and where can i find the codes for this login button..

 

If anyone know this, please post it. Need help doing this

Wilbert Tan
on 5/25/16, 5:40 AM
1

Gopakumar N G

--Gopakumar N G--
1198
| 5 3 7
Cochin, India
--Gopakumar N G--

Senior Software Engineer at BroadTech IT Solutions Pvt. Ltd.

Gopakumar N G
On 11/15/13, 6:17 AM

Check the module web, it defines the login form and js files etc, check also the file res_users.py in module base/res/ and there is the login function defined.

def login(self, db, login, password):
    if not password:
        return False
    user_id = False
    cr = pooler.get_db(db).cursor()
    try:
        # autocommit: our single update request will be performed atomically.
        # (In this way, there is no opportunity to have two transactions
        # interleaving their cr.execute()..cr.commit() calls and have one
        # of them rolled back due to a concurrent access.)
        cr.autocommit(True)
        # check if user exists
        res = self.search(cr, SUPERUSER_ID, [('login','=',login)])
        if res:
            user_id = res[0]
            # check credentials
            self.check_credentials(cr, user_id, password)
            # We effectively unconditionally write the res_users line.
            # Even w/ autocommit there's a chance the user row will be locked,
            # in which case we can't delay the login just for the purpose of
            # update the last login date - hence we use FOR UPDATE NOWAIT to
            # try to get the lock - fail-fast
            # Failing to acquire the lock on the res_users row probably means
            # another request is holding it. No big deal, we don't want to
            # prevent/delay login in that case. It will also have been logged
            # as a SQL error, if anyone cares.
            try:
                cr.execute("SELECT id FROM res_users WHERE id=%s FOR UPDATE NOWAIT", (user_id,), log_exceptions=False)
                cr.execute("UPDATE res_users SET login_date = now() AT TIME ZONE 'UTC' WHERE id=%s", (user_id,))
            except Exception:
                _logger.debug("Failed to update last_login for db:%s login:%s", db, login, exc_info=True)
    except openerp.exceptions.AccessDenied:
        _logger.info("Login failed for db:%s login:%s", db, login)
        user_id = False
    finally:
        cr.close()

    return user_id

and check the methods authenticate, check and check_credentials also.

I want to connect directly from the url like this localhost:8089/?db=dbname(other arguments)

semah
on 11/15/13, 6:26 AM

I am not sure that you can do that, check the file main.py in module web/controllers/main.py. The URL and sessions are handled in it.

Gopakumar N G
on 11/15/13, 6:40 AM

I asked a question ( help.openerp.com/question/36431/how-to-login-to-openerp-from-another-website/ ) and Fabien Pinckaers answered me " it's also possible to put login/pass in the url, but I don't remember what are the exact arguments"

semah
on 11/15/13, 6:43 AM

Thank you Gopakumar, If you find a solution please tell me.

semah
on 11/15/13, 6:56 AM

Check the module "auth_oauth" it is used for sign in to OpenERP from other accounts.

Gopakumar N G
on 12/17/13, 3:09 AM

we want to pass connection parameters in the URL and not "sign in to OpenERP from other accounts."

semah
on 12/17/13, 3:50 AM

I found it. This is the URL string http://localhost:8069/login?db=nas&login=&key=

Krishna
on 4/1/14, 4:42 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 11/14/13, 8:39 AM
Seen: 8991 times
Last updated: 10/11/16, 10:58 AM