First, add below extension to ur plugin
-ripcord_document
-ripcord_client
-ripcord
-ripcord_server
U also can get the file in fileserver
fileserver location: fileserver->Extensions->0_2024 Extensions->All Extensions->Odoo Database Extension
Second, u need create parameter in the plugin for storing database info
Need Odoo url, database name, username and the password for odoo database
Then, in ur code.
==================================================================
require_once rtrim(JPATH_SITE, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'ajax' . DIRECTORY_SEPARATOR . 'odooinvoiceandreceipt' . DIRECTORY_SEPARATOR . 'ripcord.php';
$common = ripcord::client("$url/xmlrpc/2/common");
$uid = $common->authenticate($db, $username, $password, array());
$models = ripcord::client("$url/xmlrpc/2/object");
=================================================================
U need change the plugin name to ur plugin name
Below is the example to select query for odoo, before it, u also need retrieve database info from the plugin url
=================================================================
// Get parameter from plugin
$url = $this->params->get('odoo_url');
$db = $this->params->get('database');
$username = $this->params->get('username');
$password = $this->params->get('password');
$partnerData = $models->execute_kw(
$db,
$uid,
$password,
'res.partner',
'search_read',
array(array(array('id', '=', $partnerID))) // Search criteria
);
=================================================================
Remark:
res.partner is the odoo model name, it depend what u want to retrieve
search_read is like select in query
below code can let u get all the model from ur odoo database
=================================================
$models_list = $models->execute_kw(
$db,
$uid,
$password, 'ir.model', 'search_read',
array(array()),
array('fields' => array('model'))
);
===================================================