Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
3 Risposte
12243 Visualizzazioni

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
Abbandona
Risposta migliore
query = "you query goes here"    
request.cr.execute(query)   
data = request.cr.fetchall() 
-------------------------
Avatar
Abbandona
Autore

Thank you so much. It worked.

most welcome

Post correlati Risposte Visualizzazioni Attività
2
apr 21
4817
1
set 21
2428
0
ott 21
1691
2
dic 23
30536
1
giu 15
17411