Odoo Help


XML-RPC sale.order.line, not add the good product

on 11/22/15, 12:16 AM 1,458 views


I use XML-RPC in PHP to add a new line into an existing quotation.

It work, i can add product into sale.order.line but it doesn't add the good product, if i add the product that have the id 49 it at he product with the id 45, if i add the product with id 29 it add the product with the id 25. But if i add the product with id 9 it add the good product.

It is very strange, i don't know where to look.

If you have an idea, please share :)



$o_line = array( 
      'order_id' => new xmlrpcval( $odoo_order_id, 'int'),
       'product_id' => new xmlrpcval( $a_mapping_orderlines [ 'product_1' ][0], 'int'), 'product_uom_qty' => new xmlrpcval( $a_product['quantity'], 'int'), );

$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval($dbname, "string")); $msg->addParam(new xmlrpcval($uid, "int"));
$msg->addParam(new xmlrpcval($password, "string"));
$msg->addParam(new xmlrpcval("sale.order.line", "string"));
$msg->addParam(new xmlrpcval("create", "string"));
$msg->addParam(new xmlrpcval($o_line, "struct"));
$response = $client->send($msg);

if ($response->faultCode()){
    $data['log']['order_line'][] = 'fail to create order line';
else {
    $product_id = $response->value()->scalarval();
    $data['log']['order_line'][] = 'order line created, id : '.$product_id;

On 11/23/15, 5:06 AM

Instead of adding the product_id you have to put the id of the variant.

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 11/22/15, 12:16 AM
Seen: 1458 times
Last updated: 11/23/15, 5:07 AM