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

I am trying to create report from wizard

'form_data': self.read()[0]

What is [0] refer to in this code?

self.read()  ==>read the current record?


الصورة الرمزية
إهمال
الكاتب

This is the full code:

def action_print_report(self):

data = {
'form_data': self.read()[0]


}
return self.env.ref('open_academy.report_course_detail').report_action(self, data=data)

and I'm asking why we putting [0] here?





أفضل إجابة

Hi Asmaa,

When you access self.read()[0], you are retrieving the first record in the list of records returned by self.read(). The index 0 indicates the position of the first record in the list.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
أغسطس 25
2854
1
يوليو 25
1159
1
أغسطس 25
1152
0
مايو 25
1593
2
أبريل 25
3788