Skip to Content
Menú
This question has been flagged
3 Respostes
12209 Vistes

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
Descartar
Best Answer
query = "you query goes here"    
request.cr.execute(query)   
data = request.cr.fetchall() 
-------------------------
Avatar
Descartar
Autor

Thank you so much. It worked.

most welcome

Related Posts Respostes Vistes Activitat
2
d’abr. 21
4799
1
de set. 21
2412
0
d’oct. 21
1691
2
de des. 23
30500
1
de juny 15
17387