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()
-------------------------
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
Daftar| Post Terkait | Replies | Tampilan | Aktivitas | |
|---|---|---|---|---|
|
2
Apr 21
|
6063 | |||
|
How to solved this SQL error ??
Diselesaikan
|
1
Sep 21
|
3810 | ||
|
0
Okt 21
|
1691 | |||
|
How to use self.env.cr.execute get my data?
Diselesaikan
|
2
Des 23
|
32362 | ||
|
1
Jun 15
|
19303 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.