Hello,
Description:
I have one one2many field with many2many_tags widget. After clicking on the button I want to update the one2many field. I am able to update one2manyfield. But if after a click on the button I manually refresh the page then my one2many the field is updated in the form view.
Question:
How to update one2many field without manually refreshing page.
To update field I have created python function and this function is a call from js file
Python file:
```
@api.multi
def testquestion(self,vals):
id1 = vals['id']
update_data = {}
update_data = {
'question': vals['question'],
#'type': vals['type'],
'constr_mandatory': self.constr_mandatory,
'constr_error_msg': self.constr_error_msg,
}
exiting_data = self.env['survey.question'].search([('id','=',id1)]).write(update_data)
return exiting_data #return True
```
js
file:
```
var formController = FormController.include({
_onButtonClicked: function (event) {
var self = this;
if(event.data.attrs.id === "button_update_question"){
if (this.mode != 'edit')
return undefined;
var id = $('.id_question_update').val();
var question = $('.question_class').val();
var type = $('.select_question').val();
this._rpc({
model: 'survey.survey',
method: 'testquestion',
args: [{
id: id,
question: question,
//type,
}],
}).then(function (result) {
});
}
this._super(event);
},
});
```
Thanks in advance