コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
10219 ビュー

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

アバター
破棄
最善の回答

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...
アバター
破棄
著作者

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

著作者

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?

関連投稿 返信 ビュー 活動
3
9月 20
5635
0
8月 15
19121
1
3月 15
7160
2
3月 22
6316
0
3月 15
8830