0

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)
2
  • Can you show the testquestion1 signature? Commented Mar 2, 2020 at 12:56
  • Thanks @Kenly For your replay. I have updated the question and add a testquestion1 signature can you please check. Commented Mar 4, 2020 at 4:33

1 Answer 1

1

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,
    }],
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.