Odoo Help

0

0
2 Answers
0

You are passing a single parameter to the function, which is a dictionary.

Instead of passing a dictionary, pass all variables like:


this._rpc({
model:'tcx.call.log',
method:'maakTest',

args:[pNumber,
cDuration,
datum,
pId,
pName,
],

});
}
1
Avatar

Jos De Graeve - Accomodata

--Jos De Graeve - Accomodata--
7322
| 3 1 3
RONSE, Bélgica
--Jos De Graeve - Accomodata--

CTO and partner at Accomodata

Jos De Graeve - Accomodata
04/06/19 03:48

Hi,

Your python method misses the "self" parameter:

Try this:


    @api.model
def maakTest(self, partner_id, other_party_name, other_party_number, duration, call_date_time):

vals = {'partner_id': partner_id,'other_party_name': other_party_name,'other_party_number': other_party_number,'duration':duration,'call_date_time': call_date_time}
return self.create(vals)

Basically:

* @api.model is ok for a create() function that does not operate on a recordset

* make sure self is the first parameter!

* just put the right parameters i a dictionairy, assigning them first with self.val = val is useless and might cause errors/unintended side effects.

* make sure to return the newly created record


Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now