Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
7599 Prikazi

Hi. I do a function to add many field in one field (Total), but it doesǹt work, can you help me please? Thanks

def get_total(self, cr, uid, ids, field_name, arg, context):
res = []
total = 0
curat = self.browse(cr, uid, ids, context)
for cura in curat:
    total += cura.curativedigit
    res[cura.id] = total

return res
Avatar
Opusti
Best Answer

Hello,

Try code like:

def get_total(self, cr, uid, ids, field_name, arg, context):
    res = {}
    total = 0
    curat = self.browse(cr, uid, ids, context=context)
    for cura in curat:
        total += cura.curativedigit
        res[cura.id] = total
return res
Avatar
Opusti
Avtor

thank you very much, it is running