PHP code example of metadonors / odoo-rpc-client

1. Go to this page and download the library: Download metadonors/odoo-rpc-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

metadonors / odoo-rpc-client example snippets


use OdooRPCClient\Client;

$odoo = new Client('http://localhost');

$odoo->login('odoo_database_name','username','password');

// current user
print_r($odoo->env->user);

$ids = $odoo->env['res.partner']->search();
$partner_ids = $odoo->env['res.partner']->browse($ids);

foreach($partner_ids as $partner)
{
    echo $partner->name . "\n";
    echo $partner->company_id->name . "\n";
}