Skip to content

Commit 9d045ba

Browse files
committed
[IMP]json rpc needs empty record when @api.model is used
1 parent 568a2ff commit 9d045ba

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.odoojava</groupId>
77
<artifactId>odoo-java-api</artifactId>
8-
<version>3.3.1</version>
8+
<version>3.3.2</version>
99
<packaging>jar</packaging>
1010

1111
<name>odoo-java-api</name>

src/main/java/com/odoojava/api/Session.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ private int authenticate_json_rpc() throws Throwable {
256256
methodparams.add(databaseName);
257257
methodparams.add(userName);
258258
methodparams.add(password);
259+
//TODO : maybe also use the same syntax as reporting
259260
jsonparams.put("args", methodparams);
260261

261262
int result = jsonclient.invoke("call", jsonparams, int.class);
@@ -280,12 +281,20 @@ public Object[] call_report_jsonrpc(String reportModel, String reportMethod, Arr
280281
methodparams.add(password);
281282
methodparams.add(reportModel);
282283
methodparams.add(reportMethod);
283-
methodparams.add(args);
284284

285+
ArrayList<Object> empty_recordset_for_model_annotation_in_odoo = new ArrayList<>();
286+
//The render method is annotated @model in Odoo, so we must pass an empty value as the first
287+
//paramter otherwise Odoo will only interpret 1 parameter from the 2 given
288+
//TODO: find a way to identify if a metho is annotated with @api.model
289+
args.add(0, empty_recordset_for_model_annotation_in_odoo );
290+
methodparams.add(args);
285291
jsonparams.put("args", methodparams);
286-
287292
Object[] result = jsonclient.invoke("call", jsonparams, Object[].class);
288293

294+
// methodparams.add(args);
295+
// jsonparams.put("args", methodparams);
296+
// Object[] result = jsonclient.invoke("call", jsonparams, Object[].class);
297+
289298
return result;
290299

291300
}

0 commit comments

Comments
 (0)