Issue executing search request with parameters using C# Kveer.XmlRPC. I can't understand what version of API I'm using, and I think that this can be a reason of issue. The proplem is reproducible only when I add 3 values("is_company", "=", true) in nested object of _params variable. In addition to this method, I have tried many for example set them as one value etc but I still receive errors. This is most common way people set parameters in this request(I get this from most different sources). So how to correctly set parameters? What I do wrong? Is it possible the api version can be reason of error?
Query code
private Response Demo() {
Response response = new Response();
try {
models.Url = "https://myexampledomain.odoo.com/xmlrpc/2/object";
string dbName = "myexampledomain";
string Uid = "2";
string pwd = "myexamplepassword";
string model = "res.partner";
XmlRpcStruct addPairFields = new XmlRpcStruct();
addPairFields.Add("raise_exception", "false");
object canAccess = models.CheckAccess(dbName, int.Parse(Uid), pwd, model, "check_access_rights",
new object[] { "read" }, addPairFields);
if (canAccess.ToString() == "True") {
object[] _params = new object[] {
new object[] { "is_company", "=", true }
};
var resultIds = models.Search(dbName, int.Parse(Uid), pwd, model, "search", _params);//error happen here
if (resultIds.Length == 0) {
response.Content = "No data";
return response;
}
_params = new[] {
resultIds
};
var result = models.GetData(dbName, int.Parse(Uid), pwd, model, "read", _params);
response.Content = JsonConvert.SerializeObject(result);
response.StatusCode = HttpStatusCode.OK;
return response;
}
response.Content = "Not access";
} catch (Exception ex) { SaveLog(ex, response); }
return response;
}
Full error text
{"Server returned a fault exception: [1] Traceback (most recent call last):\n File \"/home/odoo/src/odoo/14.0/odoo/addons/base/controllers/rpc.py\", line 69, in xmlrpc_2\n response = self._xmlrpc(service)\n File \"/home/odoo/src/odoo/14.0/odoo/addons/base/controllers/rpc.py\", line 49, in _xmlrpc\n result = dispatch_rpc(service, method, params)\n File \"/home/odoo/src/odoo/14.0/odoo/http.py\", line 140, in dispatch_rpc\n result = dispatch(method, params)\n File \"/home/odoo/src/odoo/14.0/odoo/service/model.py\", line 41, in dispatch\n res = fn(db, uid, *params)\n File \"/home/odoo/src/odoo/14.0/odoo/service/model.py\", line 168, in execute_kw\n return execute(db, uid, obj, method, *args, **kw or {})\n File \"/home/odoo/src/odoo/14.0/odoo/service/model.py\", line 94, in wrapper\n return f(dbname, *args, **kwargs)\n File \"/home/odoo/src/odoo/14.0/odoo/service/model.py\", line 175, in execute\n res = execute_cr(cr, uid, obj, method, *args, **kw)\n File \"/home/odoo/src/odoo/14.0/odoo/service/model.py\", line 159, in execute_cr\n result = odoo.api.call_kw(recs, method, args, kw)\n File \"/home/odoo/src/odoo/14.0/odoo/api.py\", line 392, in call_kw\n result = _call_kw_model(method, model, args, kwargs)\n File \"/home/odoo/src/odoo/14.0/odoo/api.py\", line 365, in _call_kw_model\n result = method(recs, *args, **kwargs)\n File \"/home/odoo/src/odoo/14.0/odoo/models.py\", line 1704, in search\n res = self._search(args, offset=offset, limit=limit, order=order, count=count)\n File \"/home/odoo/src/odoo/14.0/odoo/addons/base/models/res_partner.py\", line 742, in _search\n return super(Partner, self)._search(args, offset=offset, limit=limit, order=order,\n File \"/home/odoo/src/odoo/14.0/odoo/models.py\", line 4485, in _search\n if expression.is_false(self, args):\n File \"/home/odoo/src/odoo/14.0/odoo/osv/expression.py\", line 228, in is_false\n elif token[1] == 'in' and not (isinstance(token[2], Query) or token[2]):\nTypeError: 'bool' object is not subscriptable\n"}