Odoo Help


search method in xmlrpc via c# - Invalid Leaf

Daniel T Meltzer
on 3/10/14, 7:46 PM 4,730 views

I can not get the search method to work using xmlrpc in c#. I am using http:// xml-rpc.net/ as a wrapper. (I am able to use the read method to return records so xmlrpc is working in general). I have tried various models and arguments but also get that Invalid Leaf error My code is interface is :

[XmlRpcMethod("execute")] Object[] executeArraySearch(string dbName, int userId, string pwd, string model, string method, object[] filter);

Calling it with

 Object[] args2 = new Object[3];
      args2[0] = "phone";
      args2[1] = "like";
      args2[2] = "5555555%";

      Object[] results2 = warehouse.executeArraySearch(dbname,uid,pwd,"res.partner","search",args2);

The error is
Server returned a fault exception: [Invalid leaf phone] Traceback (most recent call last): File "/opt/bitnami/apps/openerp/lib/openerp-7.0_20130725_231029-py2.7.egg/openerp/service/wsgi_server.py", line 82, in xmlrpc_return result = openerp.netsvc.dispatch_rpc(service, method, params) File "/opt/bitnami/apps/openerp/lib/openerp-7.0_20130725_231029-py2.7.egg/openerp/netsvc.py", line 292, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/opt/bitnami/apps/openerp/lib/openerp-7.0_20130725_231029-py2.7.egg/openerp/service/web_services.py", line 626, in dispatch res = fn(db, uid, params) File "/opt/bitnami/apps/openerp/lib/openerp-7.0_20130725_231029-py2.7.egg/openerp/osv/osv.py", line 131, in wrapper return f(self, dbname, *args, *kwargs) File "/opt/bitnami/apps/openerp/lib/openerp-7.0_20130725_231029-py2.7.egg/openerp/osv/osv.py", line 197, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "/opt/bitnami/apps/openerp/lib/openerp-7.0_20130725_231029-py2.7.egg/openerp/osv/osv.py", line 185, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "/opt/bitnami/apps/openerp/lib/openerp-7.0_20130725_231029-py2.7.egg/openerp/osv/orm.py", line 2354, in search return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count) File "/opt/bitnami/apps/openerp/lib/openerp-7.0_20130725_231029-py2.7.egg/openerp/addons/base/res/res_partner.py", line 593, in _search count=count, access_rights_uid=access_rights_uid) File "/opt/bitnami/apps/openerp/lib/openerp-7.0_20130725_231029-py2.7.egg/openerp/osv/orm.py", line 4845, in _search query = self._where_calc(cr, user, args, context=context) File "/opt/bitnami/apps/openerp/lib/openerp-7.0_20130725_231029-py2.7.egg/openerp/osv/orm.py", line 4674, in _where_calc e = expression.expression(cr, user, domain, self, context) File "/opt/bitnami/apps/openerp/lib/openerp-7.0_20130725_231029-py2.7.egg/openerp/osv/expression.py", line 642, in __init__ self.parse(cr, uid, context=context) File "/opt/bitnami/apps/openerp/lib/openerp-7.0_20130725_231029-py2.7.egg/openerp/osv/expression.py", line 742, in parse self.stack = [ExtendedLeaf(leaf, self.root_model) for leaf in self.expression] File "/opt/bitnami/apps/openerp/lib/openerp-7.0_20130725_231029-py2.7.egg/openerp/osv/expression.py", line 528, in __init__ self.check_leaf() File "/opt/bitnami/apps/openerp/lib/openerp-7.0_20130725_231029-py2.7.egg/openerp/osv/expression.py", line 584, in check_leaf raise ValueError("Invalid leaf %s" % str(self.leaf)) ValueError: Invalid leaf phone

Daniel T Meltzer
On 3/21/14, 4:20 PM

To answer my own question - the last argument of the method is an object[]. It needs to contain an array of an array of objects with the arguments.

So the correct code to create the last argument is:

Object[] args2 = new Object[1]; Object[] subargs = new Object[3]; subargs [0] = "code"; subargs [1] = "="; subargs [2] = "USA";

args2[0] = subargs;

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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 3/10/14, 7:46 PM
Seen: 4730 times
Last updated: 3/16/15, 8:10 AM