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.
Odoo is the world's easiest all-in-one management software.
 It includes hundreds of business apps:
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.
query = "you query goes here"
request.cr.execute(query)
data = request.cr.fetchall()
-------------------------
Thank you so much. It worked.
most welcome
Create an account today to enjoy exclusive features and engage with our awesome community!
Üye Ol| İlgili Gönderiler | Cevaplar | Görünümler | Aktivite | |
|---|---|---|---|---|
|  | 2 Nis 21  | 5943 | ||
| 
            
                How to solved this SQL error ??
            
            
                    Çözüldü
            
         |  | 1 Eyl 21  | 3671 | |
|  | 0 Eki 21  | 1691 | ||
|  | 2 Ara 23  | 32171 | ||
|  | 1 Haz 15  | 19090 |