嗨,我是 Open ERP 的新手,我想使用写入方法更新 Open ERP 中的记录。以下更新代码来自doc.openerp.com上的示例:
/**
* $client = xml-rpc handler
* $relation = name of the relation ex: res.partner
* $attribute = name of the attribute ex:code
* $operator = search term operator ex: ilike, =, !=
* $id = id of the record to be updated
* $data = data to be updated
*/
include("xmlrpc.inc");
function write($client,$relation,$attribute,$operator,$data,$id) {
var $user = 'admin';
var $password = 'admin';
var $userId = -1;
var $dbname = 'db_name';
var $server_url = 'http://localhost:8069/xmlrpc/';
$id_val = array();
$id_val[0] = new xmlrpcval($id, "int");
if($userId<=0) {
connect();
}
$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval($dbname, "string"));
$msg->addParam(new xmlrpcval($userId, "int"));
$msg->addParam(new xmlrpcval($password, "string"));
$msg->addParam(new xmlrpcval($relation, "string"));
$msg->addParam(new xmlrpcval("write", "string"));
$msg->addParam(new xmlrpcval($id, "array"));
$msg->addParam(new xmlrpcval($data, "struct"));
$resp = $client->send($msg);
$val = $resp->value();
$record = $val->scalarval();
return $record;
}
在上面的代码中,当我调用 write 函数时,我必须传递 $client 的第一个参数是 xml-rpc 处理程序。但我不清楚什么是 xml-rpc 处理程序。请帮我。