fbpx

How are you doing SME Malaysia ?   I am not sure whether you realized something strange when you go to your openERP config file , and set the db_list to false and after you restart the server ,

if your browser has no cache / cookies for the previous sessions for openERP , you are fined , But
when after you login and logout a database there , you will end up  … asking  … like myself ,

where the world is my database name input  (just in case some of you do not know , if we
set the db_list to false , the db list dropdown option will become a html text entry input ) ???

and the tricks is that if you delete the cookies of “last_used_database”, dah dah , the input box
appear again , but after much hacking … reading post about python and cookies , even almost
used os.remove(‘path’) , lucky , my windows 7 is smart enough to block , hehe !!!

I end up having a simple solutions , go to
c:openerp-server-v7serveropenerpaddonswebcontrollersmain.py

def db_redirect(req, match_first_only_if_unique):

    db = False

    redirect = False

    # 1 try the db in the url

    db_url = req.params.get(‘db’)

    if db_url:

        return (db_url, False)

    dbs = db_list(req, True)

    # 2 use the database from the cookie if it’s listable and still listed , i added 

    if config[‘list_db’]:

        cookie_db = req.httprequest.cookies.get(‘last_used_database’)

        if cookie_db in dbs:

            db = cookie_db

Hope this small article help you save some of your precious time  ! till then , see ya .