Hi community,
I try to use on_change method (Odoo 9c) to change a field value on the same view, code as follow:
class xyz(models.Model):
....
'qty' : fields.integer('Qty'),
'buff_qty': fields.integer('Buffer Qty'),
....
def on_change_qty(self, cr, uid, ids, qty, context=None):
return {'value': {'buf_qty': qty}}
on view :
<field name="arch" type="xml">
<field name="qty" on_change="on_change_qty(qty)" />
The code and view loaded without error but when I changed the qty field nothing happend. I did see a "loading' text shown up on top of the form for a while , but buf_qty don't change the value as on_change defined.
I tried the @api.onchange & remove the on_change from view , code as follow
@api.onchange('probability')
def set_buff_qty(self):
self.buff_qty = self.qty
still no luck .... :(
Any thing I missed?
Thank you Community :D