Created
July 11, 2017 07:54
-
-
Save kalvian1060/1e658f4fa55875cd7015a76f5240fc05 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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