I have an php script, with this i will make an POS into odoo, but i need make a POS Reference and ID Session for this pos (point of sale). I can´t make it because the pos reference need the id session but i don´t know how.
I think that i need to run, the point of sale for obtaining the session id. The pos is created without issues, but i need make associating to one of point of sale.
This is the script.-
<?php
$url ="http://localhost:8069";
$db = "testing";
$username= "myuser";
$password ="mypass";
require_once('ripcord.php');
// Login to the account
//$erp->createRecord('pos.session', array('pos_config_id' => $posConfigId, 'pos_session_id' => 'false'))
$common = ripcord::client($url.'/xmlrpc/2/common');
//print_r($common);
$uid = $common->authenticate($db, $username, $password, array());
//print_r($uid);
$models = ripcord::client("$url/xmlrpc/2/object");
//Session
$new = $models->execute_kw($db, $uid, $password,
'pos.session.opening', 'open_session_cb',
array(array($new)),
array()
);
$new = $models->execute_kw($db, $uid, $password,
'pos.order', 'create',
array(array('partner_id'=> 1168, //cliente
'company_id' => 1, //
'user_id' => 21, //Vendedor
//'pos_reference' => 'Pedido $uid-001-0001',
//'payment_term' => 1, //inmediate payment
'state'=> 'paid',
'note'=>'compra', //Notas
'statement_ids'=> array(array(6,0,array(1))), //metodo de pago
'pricelist_id'=>1,
'session_id'=>$pos_session_id,
)));
print("<p>created new sale order with id: ");
print_r($new);
print("</p>");
// Create sale order line(s)
$sale_order_line_id = $models->execute_kw($db, $uid, $password,
'pos.order.line',
'create',
array(
array(
'order_id'=>$new, // Reference to the sale order itself
'name'=>"10 Camaron / Palta / Queso Crema", //Sale order line description
'product_id'=>140, // Products can be found from product_product
'price_unit'=>2000.00, // Unit price
'product_uom_qty' => 1.00, //taxes
'tax_ids'=>array(array(6,0,array(1))),
)
)
);
if(is_int($sale_order_line_id)){
print("<p>Invoice line created with id '{$sale_order_line_id}'</p>");
}
else{
print("<p>Error: ");
print($sale_order_line_id['faultString']);
print("</p>");
}
?>