Skip to content

Commit 3585464

Browse files
committed
more readme
2 parents f67aff3 + c953808 commit 3585464

File tree

3 files changed

+50
-12
lines changed

3 files changed

+50
-12
lines changed

README.md

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
Odoo Java Api
22
================
33

4-
This reppo is no longer maintained for new odoo versions. https://github.com/odoo-java/odoo-java-api is the appropriate project for improvements.
5-
Current issues and PR will be maintained on the new repo.
4+
This repo has been forked because of the project https://github.com/DeBortoliWines/openerp-java-api/issues/31
65

76
A Java API to connect to Odoo and manage data using the XMLRPC interface.
87

98
The API reduces the amount of boiler plate code needed to communicate with Odoo
109
by doing error checking and type conversions.
1110

12-
The Api IS known to work for :
13-
* openerp-java-api-1.3.0 works perfectly up to OpenERP v7
14-
* openerp-java-api-2.0.x si supposed to work with the new API introduced in odoo v8
11+
12+
The Api IS known to work perfectly :
13+
* openerp-java-api-1.3.0 works perfectly up to OpenERP v7 : https://github.com/DeBortoliWines/openerp-java-api/
14+
* openerp-java-api-2.0.x si supposed to work with the new API introduced in odoo v8 : https://github.com/DeBortoliWines/openerp-java-api/
1515
** Take care, the package name have replace openerp by odoo so that compatibility is broken
16-
* openerp-java-api-3.0.x , package renamed, tested on Odoo v10
16+
* openerp-java-api-3.0.x , package renamed, tested on Odoo v10 and Odoov12
1717
** purposed is to be pushed on maven for pentaho integration
1818

1919
For more information, including a Wiki please see the project on SourceForge:
@@ -39,6 +39,44 @@ Add those jar files to your classpath and you should be ok.
3939
# Examples
4040

4141
## Context manipulation
42-
Map inputMap = new java.util.HashMap();
43-
inputMap.put("active_id", move_id.toString());
44-
openERPSession.getContext().putAll(inputMap);
42+
43+
```
44+
Map inputMap = new java.util.HashMap();
45+
inputMap.put("active_id", move_id.toString());
46+
openERPSession.getContext().putAll(inputMap);
47+
```
48+
49+
## Get Many2one results
50+
51+
```
52+
/**
53+
* Get id of a Many2One property of an object row. Static method.
54+
*
55+
* @param row object row
56+
* @param property should be something like "xxx_id"
57+
* @return propertyId the id of the property
58+
*/
59+
public static Integer getMany2OneId(final Row row, final String property) {
60+
if (row != null && property != null) {
61+
Object[] propertyIdName = (Object[])row.get(property);
62+
// propertyIdName[0] = id of Many2One linked object
63+
// propertyIdName[1] = name of Many2One linked object
64+
return (propertyIdName == null ? null : (Integer)propertyIdName[0]);
65+
}
66+
return null;
67+
}
68+
```
69+
70+
## Execute command
71+
72+
```
73+
openERPSession.executeCommand("stock.inventory", "action_done",
74+
new Object[]{Integer.valueOf(inventory_id.toString())});
75+
```
76+
77+
78+
79+
# Other ressources [legacy]
80+
81+
* https://sourceforge.net/p/openerpjavaapi/wiki/Dependencies/
82+
* https://sourceforge.net/p/openerpjavaapi/wiki/Examples/

pom.xml

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

55
<groupId>com.odoojava</groupId>
66
<artifactId>odoo-java-api</artifactId>
7-
<version>3.0.1</version>
7+
<version>3.0.2</version>
88
<packaging>jar</packaging>
99

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ public void startSession() throws Exception {
149149

150150
private void checkVersionCompatibility() throws XmlRpcException, OdooApiException {
151151

152-
if (this.getServerVersion().getMajor() < 8 || this.getServerVersion().getMajor() > 10 ) {
152+
if (this.getServerVersion().getMajor() < 8 || this.getServerVersion().getMajor() > 12 ) {
153153
throw new OdooApiException(
154-
"Only Odoo Version from v8.x to 10.x are maintained. " + "Please choose another version of the library");
154+
"Only Odoo Version from v8.x to 12.x are maintained. " + "Please choose another version of the library");
155155
}
156156

157157
}

0 commit comments

Comments
 (0)