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
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
2
kwi 21
|
4814 | ||
How to solved this SQL error ??
Rozwiązane
|
|
1
wrz 21
|
2426 | |
|
0
paź 21
|
1691 | ||
How to use self.env.cr.execute get my data?
Rozwiązane
|
|
2
gru 23
|
30533 | |
|
1
cze 15
|
17408 |