Se rendre au contenu
Menu
Cette question a été signalée
3 Réponses
12238 Vues

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
Ignorer
Meilleure réponse
query = "you query goes here"    
request.cr.execute(query)   
data = request.cr.fetchall() 
-------------------------
Avatar
Ignorer
Auteur

Thank you so much. It worked.

most welcome

Publications associées Réponses Vues Activité
2
avr. 21
4816
1
sept. 21
2427
0
oct. 21
1691
2
déc. 23
30535
1
juin 15
17409