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

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
4844
1
9月 21
2461
0
10月 21
1691
2
12月 23
30590
1
6月 15
17478