I have these two fields.
'name' : fields.char('Name'),
'addresses' : fields.one2many('res.partner.address', 'partner','Addresses'),
This function:
def addresses_change(self, cr, uid, ids, name, addresses, context=None):
value = {}
new_addresses = []
address_pool = self.pool.get('res.partner.address')
for address in address_pool.browse(cr, uid, addresses[0][2], context=context):
new_addresses.append((1,address.id,{'street':'wall street','zip':'7777','partner': ids[0],'active':True}))
value.update(name='whatever')
value.update(addresses=new_addresses)
return {'value':value}
And these view fields:
<field name="name" on_change="addresses_change(name,addresses)"/>
<field name="addresses" on_change="addresses_change(name,addresses)"/>
Now when I change name
, both name
and addresses
are updated. But when I change addresses
its own value isn't updated but the name
is updated. So this bizarre behavior affects only one2many
fields. Why is this?
And how do I add on_change
event to one2many
fields that can update its own value?
EDIT: I found out that this is might be a limitation in odoo, have they fixed this issue? Link to the issue