0k / php-oe-json
OpenERP Json query
Installs: 1 769
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 7
Forks: 24
Open Issues: 3
Requires
- php: >=5.3.0
- tivoka/tivoka: 3.2.*
This package is not auto-updated.
Last update: 2024-04-13 12:27:38 UTC
README
Modest PHP class to manage OpenERP Json query.
Code maturity
Early working alpha. Comments welcome. Although it was tested against OpenERP version 6.1 and 7.0.
Features
- Simple way to add new json-rpc entry points
- Quite easy to get started (see Usage section)
- Ability to resume an open session (and thus login in openerp) with a saved
session_id
and HTTPcookie_id
(without$login
and$password
)
Usage
sample PHP code:
<?php
require_once 'openerp.php';
$oe = new PhpOeJson\OpenERP("http://localhost:8069", "test_json");
$oe->login("admin", "xxxxxx");
echo "Logged in (session id: " . $oe->session_id . ")";
$partners = $oe->read(array(
'model' => 'res.partner',
'fields' => array('name', 'city'),
));
echo "<ul>";
foreach($partners['records'] as $partner) {
echo " <li>" . $partner["name"] . " - " . $partner["city"] . "</li>\n";
}
echo "</ul>";
?>
This actual code (with small modifications) is provided in the example-project
directory which is a composer
-ready package (more about composer, how to get composer command). This means you can run composer install
on the root of the example-project
directory to install dependencies, and you'll only have to edit settings.php
and set $url
, $db
and the $login
, $password
to test it with your installation.
Please note that this is a very thin layer above Tivoka which is a JSON-RPC PHP lib.