Reputation: 107
I have one method if I am calling this python method on the button from XML as below:
<button id="button_update_question" name="testquestion1" type="object" string="Update Question" class="oe_highlight" />
Gives me self as : self: survey.survey(1,)
If I am trying to call this same python method from javascript as:
this._rpc({
model: 'survey.survey',
method: 'testquestion1',
args: [{
id: id,
question: question,
type: type,
}],
});
It gives me self as: self: survey.survey()
My question is that Why self doesn’t have any vale if calling the python method from javascript. How to achieve this. Please, anyone, help me
Thanks in advance.
Update Signature for testquestion1:
@api.multi
def testquestion1(self,vals):
print('self:',self)
id1 = vals['id']
type_val = vals['type']
update_data = {}
update_data = {
'question': vals['question'],
}
exiting_data = self.env['survey.question'].search([('id','=',id1)]).write(update_data)
Upvotes: 0
Views: 189
Reputation: 26768
Try to pass ids
to the testquestion1
method.
this._rpc({
model: 'survey.survey',
method: 'testquestion1',
args: [event.data.record.res_ids,
{
id: id,
question: question,
type: type,
}],
});
Upvotes: 1