OpenERP/Odoo 使用指定的产品 ID 创建 sale.order?
OpenERP/Odoo create sale.order with specified product id?
由于 xml-rpc 文档 OpenERP/Odoo 很差,有人可以回答如何在 PHP 中创建 sale.order 吗?
这是创建新订单的方法,另一种是创建订单行的方法
function createNewOrder($params,$model_name)
{
$client = new xmlrpc_client($this->server . "object");
$client->return_type = 'phpvals';
$msg = new xmlrpcmsg('execute');
$nval = array();
foreach($params as $k=>$v){
$nval[$k] = new xmlrpcval( $v, xmlrpc_get_type($v) );
}
$msg->addParam(new xmlrpcval($this->database, "string")); //* database name */
$msg->addParam(new xmlrpcval($this->uid, "int"));
$msg->addParam(new xmlrpcval($this->password, "string"));
$msg->addParam(new xmlrpcval($model_name, "string"));
$msg->addParam(new xmlrpcval("create", "string"));
$msg->addParam(new xmlrpcval($nval, "struct"));
//$msg->addParam(new xmlrpcval($orderPrd, "struct"));
$resp = $client->send($msg);
//$order_id_line[] = $this->$resp->value()->scalarval();
if ($resp->errno != 0)
trigger_error("sock_execute error " . $resp->errstr);
return $resp->value();
}
function createOrderLine($params,$model_name){
$client = new xmlrpc_client($this->server . "object");
$client->return_type = 'phpvals';
$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval($this->database, "string")); //* database name */
$msg->addParam(new xmlrpcval($this->uid, "int"));
$msg->addParam(new xmlrpcval($this->password, "string"));
$msg->addParam(new xmlrpcval($model_name,"string"));
$msg->addParam(new xmlrpcval("create", "string"));
$msg->addParam(new xmlrpcval($params, "struct"));
$res = $client->send($msg);
return $res;
}
由于 xml-rpc 文档 OpenERP/Odoo 很差,有人可以回答如何在 PHP 中创建 sale.order 吗?
这是创建新订单的方法,另一种是创建订单行的方法
function createNewOrder($params,$model_name)
{
$client = new xmlrpc_client($this->server . "object");
$client->return_type = 'phpvals';
$msg = new xmlrpcmsg('execute');
$nval = array();
foreach($params as $k=>$v){
$nval[$k] = new xmlrpcval( $v, xmlrpc_get_type($v) );
}
$msg->addParam(new xmlrpcval($this->database, "string")); //* database name */
$msg->addParam(new xmlrpcval($this->uid, "int"));
$msg->addParam(new xmlrpcval($this->password, "string"));
$msg->addParam(new xmlrpcval($model_name, "string"));
$msg->addParam(new xmlrpcval("create", "string"));
$msg->addParam(new xmlrpcval($nval, "struct"));
//$msg->addParam(new xmlrpcval($orderPrd, "struct"));
$resp = $client->send($msg);
//$order_id_line[] = $this->$resp->value()->scalarval();
if ($resp->errno != 0)
trigger_error("sock_execute error " . $resp->errstr);
return $resp->value();
}
function createOrderLine($params,$model_name){
$client = new xmlrpc_client($this->server . "object");
$client->return_type = 'phpvals';
$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval($this->database, "string")); //* database name */
$msg->addParam(new xmlrpcval($this->uid, "int"));
$msg->addParam(new xmlrpcval($this->password, "string"));
$msg->addParam(new xmlrpcval($model_name,"string"));
$msg->addParam(new xmlrpcval("create", "string"));
$msg->addParam(new xmlrpcval($params, "struct"));
$res = $client->send($msg);
return $res;
}