Hi everyone,
I have a on_change on a one2many to return the current sum : ProductA qty:5 ProductB qty:2 Sum :7 (5+2)
Code :
def on_change_supply(self, cr, uid, ids, supply_list, context=None):
values = { }
for item in supply_list:
total=total+item[2]['qty']
values['sum']=total
return {'value' : values}
But by this way i have only the current edit line:
If i edit the ProductA qty i will get something like supply_list=[[1, 21, {'qty':3}], [4, 22, False]]
So i must read the qty for my Product_id 22 to get it. Is there another way to get all current value on screen? To avoid to check if i have to read to get my value or not
for value in self.browse(cr, uid, ids): column1_value = val.column1 # Using Browse method and current record ID to get all the values
Yes but if i use : item=self.browse(cr, uid, ids,) for supply in item.supply_ids: I will not have the new edit value (3) but the value on db (5) for the ProductA
ID is table column value using dot notation you can get product ID