Skip to Content

Welcome!

This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

This question has been flagged
As a moderator, you can either validate or reject this answer.
Accept Reject
39 Views

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'))

);

===================================================


Avatar
Discard

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Related Posts Replies Views Activity
1
Dec 23
81