Skip to content

Commit 6241ddb

Browse files
committed
deal with correct parameter in read
1 parent 42824a7 commit 6241ddb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,14 @@ public Map<String, Object> getFields(String objectName, String[] filterFields) t
128128
*/
129129
public Object[] readObject(String objectName, Object[] ids, String[] fields) throws XmlRpcException {
130130
Object[] readResult;
131-
if (this.session.getServerVersion().getMajor() >= 8) {
131+
if (this.session.getServerVersion().getMajor() >= 8 &&
132+
this.session.getServerVersion().getMajor() < 10 ) {
132133
readResult = (Object[]) session.executeCommandWithContext(objectName, "read", new Object[]{ids, fields});
134+
}
135+
else if (this.session.getServerVersion().getMajor() >= 10 ) {
136+
//Signature of the odoo method added a load parameter
137+
// https://github.com/odoo/odoo/blob/10.0/odoo/models.py#L2995
138+
readResult = (Object[]) session.executeCommandWithContext(objectName, "read", new Object[]{ids, fields, new String[] {}});
133139
} else {
134140
//TODO: Have to be rewritten/deleted considering the previous call
135141
readResult = (Object[]) session.executeCommand(objectName, "read", new Object[]{ids, fields, session.getContext()});

0 commit comments

Comments
 (0)