Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
12211 Vistas

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

Thank you so much. It worked.

most welcome

Publicaciones relacionadas Respuestas Vistas Actividad
2
abr 21
4799
1
sept 21
2416
0
oct 21
1691
2
dic 23
30500
1
jun 15
17388