تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
12226 أدوات العرض

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

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
أبريل 21
4810
1
سبتمبر 21
2420
0
أكتوبر 21
1691
2
ديسمبر 23
30517
1
يونيو 15
17403