This question has been flagged
1 Reply
4269 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;
}



Avatar
Discard
Author Best Answer

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

Avatar
Discard