Skip to content

Commit

Permalink
Exposed json rpc method
Browse files Browse the repository at this point in the history
  • Loading branch information
fotisp committed Nov 4, 2024
1 parent 5d16430 commit 7c40c50
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.odoojava</groupId>
<artifactId>odoo-java-api</artifactId>
<version>3.3.4</version>
<version>3.3.5</version>
<packaging>jar</packaging>

<name>odoo-java-api</name>
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/com/odoojava/api/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,33 @@ public Object[] call_report_jsonrpc(String reportModel, String reportMethod, Arr

}

public Object[] execute_kw_jsonrpc(final String objectName, String commandName, final Object[] parameters)
throws Throwable {

jsonclient.setServiceUrl(getJsonurl("jsonrpc"));
Map<String, Object> jsonparams = new HashMap<>();
jsonparams.put("service", "object");
jsonparams.put("method", "execute_kw");

ArrayList<Object> methodparams = new ArrayList<>();
methodparams.add(databaseName);
methodparams.add(userID);
methodparams.add(password);
methodparams.add(objectName);
methodparams.add(commandName);


List<Object> paramsList = new ArrayList<>(Arrays.asList(parameters));
Map<String, Context> c = new HashMap<>();
c.put("context", context);
methodparams.add(paramsList);
methodparams.add(c);
jsonparams.put("args", methodparams);
Object[] result = jsonclient.invoke("call", jsonparams, Object[].class);
return result;

}

void checkDatabasePresenceSafe() {
// 21/07/2012 - Database listing may not be enabled (--no-database-list
// or list_db=false).
Expand Down

0 comments on commit 7c40c50

Please sign in to comment.