Skip to content

Instantly share code, notes, and snippets.

@kalvian1060
Created July 11, 2017 07:54
Show Gist options
  • Save kalvian1060/1e658f4fa55875cd7015a76f5240fc05 to your computer and use it in GitHub Desktop.
Save kalvian1060/1e658f4fa55875cd7015a76f5240fc05 to your computer and use it in GitHub Desktop.
URL url;
XMLRPCClient client;
try {
url = new URL(SharedData.getKeyServer()+"/xmlrpc/2/object");
client = new XMLRPCClient(url, XMLRPCClient.FLAGS_SSL_IGNORE_INVALID_CERT | XMLRPCClient.FLAGS_SSL_IGNORE_INVALID_HOST);
client.setTimeout(40000);
XMLRPCCallback listener = new XMLRPCCallback() {
public void onResponse(long id, Object result) {
// Handling the servers response
}
public void onError(long id, XMLRPCException error) {
// Handling any error in the library
}
public void onServerError(long id, XMLRPCServerException error) {
// Handling an error response from the server
}
};
List conditions= Arrays.asList(Arrays.asList(Arrays.asList("type", "=", "product")));
Map fields = new HashMap() {{
put("fields", Arrays.asList("id", "name", "list_price", "standard_price", "categ_id", "create_date", "image"));
put("limit", 30);
put("order", "id");
}};
client.callAsync(listener, "execute_kw",database,
Integer.parseInt(uid), password,
"product.template", "search_read", conditions,fields);
} catch (Exception ex) {
Log.e("ODOO UTILITY", ex.getMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment