Skip to Content
Menu
This question has been flagged

I am trying to create a sales order quotation using the php ripcord API.
I am able to create the quotation but quotation has no any product.

Means I am unable to add the products inside the quotations. 


require_once('ripcord/ripcord.php');

// Login to the account

$common = ripcord::client($url.'/xmlrpc/2/common');

$uid = $common->authenticate($db, $username, $password, array());

$models = ripcord::client("$url/xmlrpc/2/object");


$quotation = $models->execute_kw($db, $uid, $password,

    'sale.order', 'create',

    array(array('partner_id'=> 7,

            'product_id'=> 30,

            'name'=>'Hello1', 

            'product_uom_qty'=>10,

                'price_unit'=>300,

                'price_total'=>3000,

                'payment_term' => 1,    //immediate payment

               // 'medium_id' => 1

                )));

echo 'created new sale order with id:' . $quotation;



I am new at Odoo, Kindly help me
Thanks

Avatar
Discard

Thank you for updating your post, I've made my own XML RPC Adapter only to make this but in VB. It's very helpful to have the exact fields I need to make this.

Author Best Answer

I got the result. I need to create sale.order then after add the product to the sale.order.line using order ID

Here is the updated code.


require_once('ripcord/ripcord.php');

// Login to the account

$common = ripcord::client($url.'/xmlrpc/2/common');

$uid = $common->authenticate($db, $username, $password, array());

$models = ripcord::client("$url/xmlrpc/2/object");


// Creating the Quotation

 $id = 7; // Customer ID

$order_line = $models->execute_kw($db, $uid, $password,

    'sale.order', 'create',

    array(array('partner_id'=> $id,

            'product_id'=> 30,

            'name'=>'Hello2',

                'payment_term' => 1,    //immediate payment

               // 'medium_id' => 1

                )));


echo 'created new sale order with id:' . $order_line;


$id2 = $order_line;

$order_line2 = $models->execute_kw($db, $uid, $password,

    'sale.order.line', 'create',

    array(array('order_id'=> $id2,

            'product_id'=> 1,

            'name'=>'ABCD Product', //Quotation No. will relaced by the name (Quotation Name)//

            'product_uom_qty'=>10,

                'price_unit'=>300,

                'price_total'=>3000,

                )));


echo 'created new sale order line with id:' . $order_line2;


Avatar
Discard
Related Posts Replies Views Activity
1
Jun 23
2442
1
Jun 23
2954
1
Sep 20
7224
1
Aug 25
256
1
Aug 24
5305