Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
8186 Visualizações

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
Cancelar

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 Melhor resposta

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
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
1
jun. 23
2442
1
jun. 23
2953
1
set. 20
7218
1
ago. 25
251
1
ago. 24
5304