Odoo: (u"Database fetch misses ids ('7') and has extra ids (7), may be caused by a type incoherence in a previous request", None)

Created on 30 Jan 2016  路  3Comments  路  Source: odoo/odoo

I installed Odoo 9.0-20160128 on WIN 10. I added to it Sales Management and Purchase Management. I am trying to connect to it from java via XMLRPC with apache xmlrpc library.
Here is the code I use:

String url = "http://localhost:8069/xmlrpc/2/object";
        XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
        try {
            config.setServerURL(new URL(url));
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }

        XmlRpcClient client = new XmlRpcClient();
        client.setConfig(config);

        Object[] params = new Object[]{"tester", "7", "somepwd", "sale.order", "search",  new Object[]{new Object[]{
                new Object[]{"id", ">=", 9}}}};
        try {
            Object[] res = (Object[])client.execute("execute_kw",params);
            System.out.print(Arrays.toString(res));
        } catch (XmlRpcException e) {
            e.printStackTrace();
        }

When I run it I get this:
org.apache.xmlrpc.XmlRpcException: (u"Database fetch misses ids ('7') and has extra ids (7), may be caused by a type incoherence in a previous request", None)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:197)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:137)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:126)
at Main.main(Main.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

If instead of sale.order I use product.product or res.partner I get as expected a list of ids. I already have sales order in the system as well as products.
I have absolutely no idea what this error means. I would love it if you could make the error messages more readable to someone who faces such a system for the first time.

Looking in models.py to see what is there I was even more stumped:

 # store failed values in cache for the records that could not be read
        missing = self - fetched
        if missing:
            extras = fetched - self
            if extras:
                raise AccessError(
                    _("Database fetch misses ids ({}) and has extra ids ({}), may be caused by a type incoherence in a previous request").format(
                        ', '.join(map(repr, missing._ids)),
                        ', '.join(map(repr, extras._ids)),
                    ))

Any thoughts on this?

Thanks,
Alex

Most helpful comment

Nevermind. I figured it out.. Thee uid I passed as string but should have been a number.

Using

 Object[] params = new Object[]{"tester", 7, "somepwd", "sale.order", "search",  new Object[]{new Object[]{
                new Object[]{"id", ">=", 9}}}};

worked. Strange thing is why it works with uid as a string when searching for res.partner.
Anyways, I'm happy now.

All 3 comments

Nevermind. I figured it out.. Thee uid I passed as string but should have been a number.

Using

 Object[] params = new Object[]{"tester", 7, "somepwd", "sale.order", "search",  new Object[]{new Object[]{
                new Object[]{"id", ">=", 9}}}};

worked. Strange thing is why it works with uid as a string when searching for res.partner.
Anyways, I'm happy now.

I met same issue in odoo11

This is because a browse with a string is done instead with an integer. If it's in your custom code, check it. If it's in standard Odoo code, put a new issue with the steps to reproduce or if you are able to identify in which place of the code is happening, make a PR or point to that line in a new issue.

Was this page helpful?
0 / 5 - 0 ratings