def onchange_partner(self, cr, uid, ids, partner_id, context=None):
res = {}
if partner_id:
obj = self.pool.get('res.partner').browse(cr, uid, partner_id)
res['field1'] = obj.field1
res['field2'] = obj.field2
res['field3'] = 'Hello' # this field type must be char or if not then give
#value accordingly, its just to prove you that values are filled on onchange.
return {'value': res}
def onchange_partner(self, cr, uid, ids, partner_id, context=None):
but i am not write "onchange_partner" because it using without xml how it
There is two way to write onchange method.
Old Api :
in model.py
in model_view.xml
if you are using old api you need to add onchange attribute on field in xml view.
New Api :
in new API you need to add decorator which trigger the call to the decorated function if any of the fields specified in the decorator is changed in the form.