跳至内容
菜单
此问题已终结
1 回复
1654 查看

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
8月 25
2654
1
7月 25
1034
1
8月 25
1151
0
5月 25
1491
2
4月 25
3646