Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
3703 Weergaven

Please look at the following code block:


    class hr_payslip:
...
        @api.multi      # same behavior with or without this line 
        def do_something(self):
            print "self------------------------------->",self
            for r in self:
                print "r------------------------------->",r


I'm overriding a hr.payslip model and I need to access an id field inside this method. The problem is that it doesn't make sense to me what gets printed:

self-------------------------------> hr.payslip(hr.payslip(1,),)

r-------------------------------> hr.payslip(hr.payslip(1,),)

Why is it the same thing inside and outside of for loop. If it's always a 'recordset', how would one access one record's field.



Avatar
Annuleer
Auteur

I posted this to StackOverflow, so no need to publish now..

Beste antwoord
@api.model        
def do_something(self):
    print 'self', self.id
    for r in self:
        print 'r', r.id
Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
0
feb. 25
2007
0
jan. 25
1783
1
dec. 24
2220
1
jun. 22
6650
1
okt. 20
3338