Skip to Content
Menú
This question has been flagged
1 Respondre
10211 Vistes

How to use database cursor in OpenERPAuthProvider in http_server.py in server part??

Avatar
Descartar
Best Answer

Hello you can do:

from openerp import pooler, sql_db
# Get database connexion
db = sql_db.db_connect(db_name) # You can get the db name from config
cr = db.cursor()

# Access pooler the one in self.pool
pool = pooler.get_pool(cr.dbname)
pool['res.user'].browse...
Avatar
Descartar
Autor

Hello nbessi, thank you for your useful answer but actually i don't know how to get db_name pro grammatically in my case,,,so it will be very helpful if you will tell me , how to fetch "db_name" from config(which you are saying)... Thank you

Autor

Hello nbessi,,,i have tried your given solution and i have done what i want thank you so much for your help.

This way i do get access to db but only to some models like res.partner but not to other models like product.product or website ?!? How can i access models like website too?

Related Posts Respostes Vistes Activitat
3
de set. 20
5634
0
d’ag. 15
19119
1
de març 15
7155
2
de març 22
6315
0
de març 15
8828