跳至内容

欢迎!

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.

此问题已终结
作为版主,您可以批准或拒绝该答案。
接受 拒绝
82 查看

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

);

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


形象
丢弃

您的回复

请大家尽量给个实质性的回答。如果您想回答这个问题或发表评论,只需 使用评论工具。请记住,您可以随时修改您的答案。 - 不用重复回答同样的问题。另外,请不要忘记投票 - 它确实有助于选择最好的问题和答案!

相关帖文 回复 查看 活动
1
12月 23
112