콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
9827 화면

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
5290
0
8월 15
18778
1
3월 15
6879
2
3월 22
6030
0
3월 15
8523