Php 通过外部id读取XML-RPC

Php 通过外部id读取XML-RPC,php,xml-rpc,odoo,Php,Xml Rpc,Odoo,这里有一个场景,我需要使用XMLRPC通过外部id从openerp/odoo读取/检索元素。我使用的技术是php。 以下是我从odoo读取/检索数据的代码函数: public function read($ids, $fields, $model_name, $context=array() ) { $client = new xmlrpc_client($this->server."object"); // ['execute','userid','password',

这里有一个场景,我需要使用XMLRPC通过外部id从openerp/odoo读取/检索元素。我使用的技术是php。 以下是我从odoo读取/检索数据的代码函数:

public function read($ids, $fields, $model_name, $context=array() ) {
    $client = new xmlrpc_client($this->server."object");
    //  ['execute','userid','password','module.name',{values....}]
    $client->return_type = 'phpvals';
    $id_val = array();
    $count = 0;
    foreach ($ids as $id)
        $id_val[$count++] = new xmlrpcval($id, "int");
    $fields_val = array();
    $count = 0;
    foreach ($fields as $field)
        $fields_val[$count++] = new xmlrpcval($field, "string");
    $msg = new xmlrpcmsg('execute');
    $msg->addParam(new xmlrpcval($this->database, "string"));  //* database name */
    $msg->addParam(new xmlrpcval($this->uid, "int")); /* useid */
    $msg->addParam(new xmlrpcval($this->password, "string"));/** password */
    $msg->addParam(new xmlrpcval($model_name, "string"));/** model name where operation will be held * */
    $msg->addParam(new xmlrpcval("read", "string"));/** method which u like to execute */
    $msg->addParam(new xmlrpcval($id_val, "array"));/** ids of record which to be updated...This array must be xmlrpcval array */
    $msg->addParam(new xmlrpcval($fields_val, "array"));/** parameters of the methods with values....*/
    //values added
    $ctx = array();
    foreach($context as $k=>$v){
       $ctx[$k] = new xmlrpcval( xmlrpc_get_type($v) );
    }

   //end

    if(!empty($context)){
       // $msg->addParam(new xmlrpcval(array("lang" => new xmlrpcval("nl_NL", "string"),'pricelist'=>new xmlrpcval($context['pricelist'], xmlrpc_get_type($context['pricelist']) )) , "struct"));
    }
    $resp = $client->send($msg);
    print_r($resp);
    if ($resp->faultCode())
        return -1;   /* if the record is not writable or not existing the ids or not having permissions*/
    else
        return $resp->value();

}

它只给出了id和名称,而在我这边没有给出我试图从odoo中读取的odoo中数据的具体外部id。

在odoo中,ir\u model\u data是存储外部id、model及其数据库id的模型


尝试从ir\U模型数据中搜索外部id从搜索结果中获取记录id后,您可以读取该记录以获取该记录的数据库id。

我的预期输出是能够通过外部id读取/检索odoo数据。