Hi
So I'm trying to call a Python method from JavaScript and it's producing a certain error. I tried following guidelines on how to call methods but I think there's something wrong with the arguments.
Here is the Python method:
@api.model
def maakTest(partner_id, other_party_name, other_party_number, duration, call_date_time):
#def maakTest(partner_id, other_party_name, other_party_number, duration, call_date_time):
self.partner_id = partner_id
self.other_party_name = other_party_name
self.other_party_number = other_party_number
self.note = duration
self.call_date_time = call_date_time
vals = {'partner_id':self.partner_id,'other_party_name':self.other_party_name,'other_party_number':self.other_party_number,'duration':self.duration,'call_date_time':self.call_date_time}
self.create(vals)
Here is the JS method (specifically in bold):
handleEnded: function (cmd) {
            var self = this;
            self.$(".phonering-alo-ph-img-circle").css("visibility","hidden");
            if (cmd.CallID == self.callId) {
                if (self.callState == "Ringing") {
                    // Show missed call screen
                }
                else if (self.callState == "Connected") {
                    self.stopTimer();
                    self.$(".tcx_button_end_call").css("display", "none");
                    self.$(".dial_pad").css("display", "none");
                    //self.$(".tcx_now_number").css("display","none");
                    //self.$(".tcx_backspace").css("display","none");
                    this.hideDialPad();
                }
                self.$(".tcx_mute_hold").css("display", "none");
                this.callState = "Ended";
                var today = new Date();
                var y = today.getFullYear().toString();
                var m = (today.getMonth() + 1).toString();
                var d = today.getDate().toString();
                (d.length == 1) && (d = '0' + d);
                (m.length == 1) && (m = '0' + m);
                var datum = y + '-' + m + '-' + d;
                console.log(this.partnerId);
                console.log(this.partnerName);
                console.log(this.partnerNumber);
                console.log(this.callDuration);
                console.log(datum);
                var pId = this.partnerId;
                var pName = this.partnerName;
                var pNumber = this.partnerNumber;
                var cDuration = this.callDuration;
                this._rpc({
                        model:'tcx.call.log',
                        method:'maakTest',
                        
                        args:[{
                            'other_party_number': pNumber,
                            'duration': cDuration,
                            'call_date_time': datum, 
                            'partner_id': pId,
                            'other_party_name': pName,
                        }],
                    });
            }
        }
Here is the error I'm getting in Odoo:
Traceback (most recent call last):
  File "/opt/odoo/odoo/odoo/http.py", line 654, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/odoo/odoo/http.py", line 312, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/opt/odoo/odoo/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/opt/odoo/odoo/odoo/http.py", line 696, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/odoo/odoo/http.py", line 344, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/odoo/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/odoo/odoo/http.py", line 337, in checked_call
    result = self.endpoint(*a, **kw)
  File "/opt/odoo/odoo/odoo/http.py", line 939, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/odoo/odoo/http.py", line 517, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/odoo/addons/web/controllers/main.py", line 962, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/odoo/addons/web/controllers/main.py", line 954, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/odoo/odoo/api.py", line 745, in call_kw
    return _call_kw_model(method, model, args, kwargs)
  File "/opt/odoo/odoo/odoo/api.py", line 718, in _call_kw_model
    result = method(recs, *args, **kwargs)
TypeError: maakTest() missing 3 required positional arguments: 'other_party_number', 'duration', and 'call_date_time'I'm also getting a JS error but it seems to be the same one:
web.assets_common.js:3555
 Server application error {"code":200,"message":"Odoo Server 
Error","data":{"name":"builtins.TypeError","debug":"Traceback (most 
recent call last):\n  File \"/opt/odoo/odoo/odoo/http.py\", line 654, in
 _handle_exception\n    return
 super(JsonRequest, self)._handle_exception(exception)\n  File 
\"/opt/odoo/odoo/odoo/http.py\", line 312, in _handle_exception\n    
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])\n 
 File \"/opt/odoo/odoo/odoo/tools/pycompat.py\", line
 87, in reraise\n    raise value\n  File 
\"/opt/odoo/odoo/odoo/http.py\", line 696, in dispatch\n    result = 
self._call_function(**self.params)\n  File 
\"/opt/odoo/odoo/odoo/http.py\", line 344, in _call_function\n    return
 checked_call(self.db, *args, **kwargs)\n 
 File \"/opt/odoo/odoo/odoo/service/model.py\", line 97, in wrapper\n   
 return f(dbname, *args, **kwargs)\n  File 
\"/opt/odoo/odoo/odoo/http.py\", line 337, in checked_call\n    result =
 self.endpoint(*a, **kw)\n  File \"/opt/odoo/odoo/odoo/http.py\", line
 939, in __call__\n    return self.method(*args, **kw)\n  File 
\"/opt/odoo/odoo/odoo/http.py\", line 517, in response_wrap\n    
response = f(*args, **kw)\n  File 
\"/opt/odoo/odoo/addons/web/controllers/main.py\", line 962, in 
call_kw\n    return self._call_kw(model,
 method, args, kwargs)\n  File 
\"/opt/odoo/odoo/addons/web/controllers/main.py\", line 954, in 
_call_kw\n    return call_kw(request.env[model], method, args, 
kwargs)\n  File \"/opt/odoo/odoo/odoo/api.py\", line 745, in call_kw\n   
 return _call_kw_model(method,
 model, args, kwargs)\n  File \"/opt/odoo/odoo/odoo/api.py\", line 718, 
in _call_kw_model\n    result = method(recs, *args, 
**kwargs)\nTypeError: maakTest() missing 3 required positional 
arguments: 'other_party_number', 'duration', and 
'call_date_time'\n","message":"maakTest()
 missing 3 required positional arguments: 'other_party_number', 
'duration', and 'call_date_time'","arguments":["maakTest() missing 3 
required positional arguments: 'other_party_number', 'duration', and 
'call_date_time'"],"exception_type":"internal_error"}}
(anonymous) @ web.assets_common.js:3555
         
Any help would be greatly appreciated.
