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

How to execute sql query on website controller?


I need to get data from a many2many field:

my code:

        self.env.execute('SELECT * from customer_ids')

        res = self.env.fetchall()

     

But this doesn't work in the controllers. Hope you can help me. Thank you.


아바타
취소
베스트 답변
query = "you query goes here"    
request.cr.execute(query)   
data = request.cr.fetchall() 
-------------------------
아바타
취소
작성자

Thank you so much. It worked.

most welcome

관련 게시물 답글 화면 활동
2
4월 21
5321
1
9월 21
2951
0
10월 21
1691
2
12월 23
31312
1
6월 15
18186