skip to Main Content

I’m writing a PHP library for accessing the Odoo XML-RPC API and I need to know the Odoo version of the server I’m talking to – but I can’t figure out how to determine the version. Is there a certain model that will tell me or how do I do that?

UPDATE

I thought I have figured it out. The ir.module.module model will give you a list of all the installed modules. Then in the base module you look at the installed_version property. BUT this requires admin access! I need to do this as the regular user that is normally using the API.

But for anyone who has that kind of access this is what you would do. Using ripcord (see example here) you would use this line to retrive just the base module:

$models->execute_kw($db, $username, $password, 'ir.module.module', 'search_read', array(array(array('name', '=', 'base'))) );

2

Answers


  1. You can get the Odoo version even without authentication from the API common endpoint. See documentation on https://www.odoo.com/documentation/12.0/webservices/odoo.html heading ”Logging in” and the first code sample there. You can find the server_version property there.

    $common = ripcord::client($url.'/xmlrpc/2/common');
    $common->version();
    
    Login or Signup to reply.
  2. Following code is valid and working fine tested on multiple servers.

    $url = 'https://###.###.###.##:8069'; 
    $db = 'demo'; 
    $username = 'user_name'; 
    $password = 'password';
    $common = ripcord::client("$url/xmlrpc/2/common"); 
    $models = ripcord::client("$url/xmlrpc/2/object"); 
    $common->version(); 
    $uid = $common->authenticate($db, $username, $password, array());
    

    These examples use the Ripcord library, which provides a simple
    XML-RPC API. Ripcord requires that XML-RPC support be enabled in your
    PHP installation.

    Since calls are performed over HTTPS, it also requires that the
    OpenSSL extension be enabled.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search