Odoo Help


Get current value [on_change]

on 12/31/13, 7:02 AM 1,309 views

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:
        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

on 12/31/13, 7:10 AM

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

on 12/31/13, 7:57 AM

ID is table column value using dot notation you can get product ID

on 12/31/13, 8:24 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 12/31/13, 7:02 AM
Seen: 1309 times
Last updated: 3/16/15, 8:10 AM