Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odpovědi
12763 Zobrazení

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šit
Nejlepší odpověď
query = "you query goes here"    
request.cr.execute(query)   
data = request.cr.fetchall() 
-------------------------
Avatar
Zrušit
Autor

Thank you so much. It worked.

most welcome

Related Posts Odpovědi Zobrazení Aktivita
2
dub 21
5341
1
zář 21
2962
0
říj 21
1691
2
pro 23
31326
1
čvn 15
18202