Skip to Content
Menu
This question has been flagged
2 Replies
7950 Views

Hi,

I'm trying to connect to Odoo using Javascript and xmlrpc library but I don't know what I'm doing wrong.


This is my Javascript code:


var inParams = [];

  inParams.push([['is_company', '=', true],['customer', '=', true]]);

  var parametros = [];

  parametros.push(inParams);

  $.xmlrpc({

   url: 'http://192.168.1.15:8069/xmlrpc/2/object',

   methodName: 'execute_kw',

   crossDomain: true,

   params:['midatabase',uid,'mipass','res.partner', 'search', parametros],

   success: function(response, status, jqXHR) {alert(response);},

   error: function(jqXHR, status, error) { alert('Error : ' + error ) }

   })


I always obtain this error: TypeError: unhashable type: 'list' but I don't know how to fix

Thanks



Avatar
Discard
Author

Any Update about this?

Best Answer

Here is an example code:


odoo.connect(function (err) {
    if (err) { return console.log(err); }
    console.log('Connected to Odoo server.');
    var inParams = [];
    inParams.push('read');
    inParams.push(false); //raise_exception
    var params = [];
    params.push(inParams);
    odoo.execute_kw('res.partner', 'check_access_rights', params, function (err, value) {
        if (err) { return console.log(err); }
        console.log('Result: ', value);
    });
});

Please have a look here

Avatar
Discard
Author Best Answer

Hi Hilar,

Your code is for node.js but no for jquery. If I want to call and comunicate with a mobile phone using Apache Cordova to Odoo, I need jquery, not node.js.


Thanks

Avatar
Discard