Odoo Help


OpenERP Java API

on 3/2/13, 7:06 AM 4,887 views

Hi everybody.

Sorry to bother you but i'm newbie on using Open ERP webservices functionnalities. So I decided to use the OpenERP Java API in order to communicate with the Open Erp XML-RPC webservices.

At the moment, i manage to get the information about a sale order but i couldn't get data about the partner who order it.

Here is my code sample :

public Integer deployDocumentAPI(String nameFile) throws MalformedURLException {
    Session openERPSession = new Session("", 8069, "hiveSharing", "webservice", "root");
    try {
        // startSession logs into the server and keeps the userid of the logged in user
        ObjectAdapter orderAd = openERPSession.getObjectAdapter("sale.order");
        FilterCollection filters = new FilterCollection();
        RowCollection orders = orderAd.searchAndReadObject(filters, new String[]{"name","state","partner_id"});

        for (Row row : orders){
            System.out.println("Row ID: " + row.getID());
            System.out.println("Name:" + row.get("name"));
            System.out.println("Etat:" + row.get("state"));

            //everything is ok up to here

            //Adapter partner
            ObjectAdapter partnerAd = openERPSession.getObjectAdapter("res.partner");

            //row.get("partner_id") gives me an object that i can't manage to use

            RowCollection partners = partnerAd.readObject((Object[]) row.get("partner_id"), new String[]{"name"});

            for (Row rowP : partners){
                System.out.println("Partner:" + rowP.get("name"));

        return 1;

    } catch (Exception e) {
        System.out.println("Error while reading data from server:\n\n" + e.getMessage());
        return 0;

According to the error I get, the readObject method is waiting for a collection of ids but how can i get the ids if I'am unable to read the object .....

It makes me crazy.

If someone is familiar to this APi, please help me ^^

PS : I'm french so sorry for my english ;-)

On 4/10/13, 3:48 AM

Try this way:

Object partnerID[] = (Object[]) row.get("partner_id"); System.out.println(partnerID[0]);

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/2/13, 7:06 AM
Seen: 4887 times
Last updated: 3/16/15, 8:10 AM