Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
1650 Zobrazení

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?


Avatar
Zrušit
Autor

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?





Nejlepší odpověď

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.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
srp 25
2636
1
čvc 25
1026
1
srp 25
1151
0
kvě 25
1482
2
dub 25
3633