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()
-------------------------
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký| Bài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
|---|---|---|---|---|
|
2
thg 4 21
|
6074 | |||
|
How to solved this SQL error ??
Đã xử lý
|
1
thg 9 21
|
3817 | ||
|
0
thg 10 21
|
1691 | |||
|
2
thg 12 23
|
32372 | |||
|
1
thg 6 15
|
19321 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.