Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
8204 Ansichten

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
Verwerfen

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.

Autor Beste Antwort

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
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Juni 23
2449
1
Juni 23
2957
1
Sept. 20
7227
1
Aug. 25
263
1
Aug. 24
5315