Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
8201 Vizualizări

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

Imagine profil
Abandonează

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 Cel mai bun răspuns

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;


Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
iun. 23
2446
1
iun. 23
2955
1
sept. 20
7227
1
aug. 25
258
1
aug. 24
5313