@@ -30,6 +30,10 @@ Publish `config\odoo-api.php` using the Laravel artisan command:
3030
3131A sample set of entries for ` .env ` can be found in ` .env.example ` .
3232
33+ You can add multiple sets of configuration to ` config\odoo-api.php ` and
34+ use them all at once in your application.
35+ The configuration set name is passed in to ` OdooApi::getClient('config-name') ` .
36+
3337# Example
3438
3539A very simple example:
@@ -71,6 +75,13 @@ $client->searchCount('res.partner', $criteria);
7175$client->read('res.partner', [17858, 17852])->value()->me['array']
7276```
7377
78+ If you have specific requirements for the XML-RPC client, such as an SSL
79+ certificate to add, then yiu can get the client instance using:
80+
81+ $xmlRpcClient = $client->getXmlRpcClient($type);
82+
83+ where ` $type ` will typically be 'db', 'common' or 'object'.
84+
7485# Query methods
7586
7687The following methods are supported and will return an XML-RPC response:
@@ -87,17 +98,31 @@ The following helper functions return a native PHp type insead:
8798* searchCount - integer
8899* getResourceId - integer
89100
101+ (I'm torn between this approach and a more fluent approach such as
102+ ` $client->firstOnly()->asArray()->read(...) ` )
103+
90104Note that ` searchRead ` will emulate the server's ` search_read ` for
91105Odoo versions less than 8.0 (OpenERP) but use the native ` search_read `
92106for Odoo 8.0 upwards.
93107
108+ # Read Options
109+
110+ The ` read() ` method takes an options array that varies significantly
111+ between OpenERP/Odoo versions.
112+ This package does not attempt to deal with that at this time.
113+
114+ Fpor example, to restrict the read to named attributes, the following
115+ formats are used:
116+
117+ * OpenERP 7: $client->read('account.invoice', [ 123] , [ 'type', 'partner_id'] );
118+ * OpenERP 8: $client->read('account.invoice', [ 123] , [ 'fields' => [ 'type', 'partner_id']] );
119+ * OpenERP 10: $client->read('account.invoice', [ 123] , [ 'attributes' => [ 'type', 'partner_id']] );
120+
121+ This makes finding help on the API difficult, since many articles
122+ fail to make the OpenERP/Odoo version number clear.
123+
94124# TODO
95125
96- * An elegant way to parse the results, as the ` Value ` objects can be
97- a little cumbersome.
98- For example, we know the ` search() ` result will be an array of
99- integer model instance IDs, so a simple array or collection of IDs can
100- be returned, rather than a Value array containing Value integer objects.
101126* Docs on config (this package supports multiple clients, so can connect
102127 to multiple Odoo instances or as multiple users at the same time).
103128* Docs on installation (has a auto discovered provider and facade).
0 commit comments