Yes, you can. From method of your button you can call your onchange method. Onchange will return dictionary, you have to fetch values from dictionary and pass that dictionary in write method.
def your_btn_method(self, cr, uid, ids, context=None):
for rec in self.browse(cr, uid, ids, context=context):
#Pass required fields value as a parameter in onchange
res = self.your_onchange(cr, uid, [rec.id], rec.field1, rec.field2)
self.write(cr, uid, [rec.id], res.get('values'), context=context)
Hope this will help you.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 9/18/14, 7:31 AM|
|Seen: 1682 times|
|Last updated: 3/16/15, 8:10 AM|