Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
8203 Переглядів

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

Аватар
Відмінити

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.

Автор Найкраща відповідь

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;


Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
черв. 23
2446
1
черв. 23
2957
1
вер. 20
7227
1
серп. 25
258
1
серп. 24
5313