1
1
Odoo Java Api
2
2
================
3
3
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
6
5
7
6
A Java API to connect to Odoo and manage data using the XMLRPC interface.
8
7
9
8
The API reduces the amount of boiler plate code needed to communicate with Odoo
10
9
by doing error checking and type conversions.
11
10
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/
15
15
** 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
17
17
** purposed is to be pushed on maven for pentaho integration
18
18
19
19
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.
39
39
# Examples
40
40
41
41
## 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/
0 commit comments