Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odgovori
12743 Prikazi

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

Thank you so much. It worked.

most welcome

Related Posts Odgovori Prikazi Aktivnost
2
apr. 21
5321
1
sep. 21
2951
0
okt. 21
1691
2
dec. 23
31312
1
jun. 15
18186