跳至內容
選單
此問題已被標幟
3 回覆
12754 瀏覽次數

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
5332
1
9月 21
2957
0
10月 21
1691
2
12月 23
31317
1
6月 15
18198