Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
10227 Prikazi

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

Avatar
Opusti
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
Opusti
Avtor

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

Avtor

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 Odgovori Prikazi Aktivnost
3
sep. 20
5638
0
avg. 15
19126
1
mar. 15
7186
2
mar. 22
6317
0
mar. 15
8832