Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
10408 มุมมอง

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?

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ก.ย. 20
5834
0
ส.ค. 15
19316
1
มี.ค. 15
7343
2
มี.ค. 22
6445
0
มี.ค. 15
9001