Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
1638 Widoki

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?


Awatar
Odrzuć
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?





Najlepsza odpowiedź

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.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
sie 25
2547
1
lip 25
961
1
sie 25
1151
0
maj 25
1403
2
kwi 25
3595