Odoo Help

Welcome!

This community 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.

0

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

By
Sebastian782
on 11/22/15, 12:16 AM 652 views

Hi,

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

Thank,

Sebastian.

$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;
}



0
Sebastian782
On 11/23/15, 5:06 AM

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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