Skip to Content
Menu
This question has been flagged
3 Replies
12647 Rodiniai

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.


Portretas
Atmesti
Best Answer
query = "you query goes here"    
request.cr.execute(query)   
data = request.cr.fetchall() 
-------------------------
Portretas
Atmesti
Autorius

Thank you so much. It worked.

most welcome

Related Posts Replies Rodiniai Veikla
2
bal. 21
5204
1
rugs. 21
2835
0
spal. 21
1691
2
gruod. 23
31151
1
birž. 15
17977