Skip to Content
Menu
This question has been flagged
3 Replies
12728 Zobrazenia

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.


Avatar
Zrušiť
Best Answer
query = "you query goes here"    
request.cr.execute(query)   
data = request.cr.fetchall() 
-------------------------
Avatar
Zrušiť
Autor

Thank you so much. It worked.

most welcome

Related Posts Replies Zobrazenia Aktivita
2
apr 21
5296
1
sep 21
2949
0
okt 21
1691
2
dec 23
31294
1
jún 15
18148