2014-10-28 54 views
0

我嘗試將我的電子商務平臺的發票推送給odoo。 (php - xml-rpc) 發票已創建,但我沒有找到如何創建工作流來更改Odoo中的狀態。Odoo如何在PHP中爲XML-RPC中的發票開發工作流程?

我發現互聯網上的東西,但我認爲這是老人和它的Odoo但OpenERP的V6發動機不工作或7

注:鏈接:http://goo.gl/lBPWnG

//validate the invoice 
echo "VALIDATE<BR /><BR />"; 
$conn->workflow('account.invoice', 'invoice_open', $invoice_id); 

你有一個主意 ?

謝謝

我在XML-RPC代碼時,我創建Odoo發票。

// ********************************** 
// Write a new concerning the shipping by the service line 
// ********************************** 
// invoice line 
      $shipping_account_id; // id ofaccount shipping 626000 

      $val = array (
          "invoice_id" => new xmlrpcval($invoice_id, "int"), 
          "account_id" => new xmlrpcval($shipping_account_id, "int"), 
          "company_id" => new xmlrpcval($company_id, "int"), 
          "product_id" => new xmlrpcval($odoo_products_id, "string"), 
          "name" => new xmlrpcval('Service postale', "string"), 
          "quantity" => new xmlrpcval('1',"double"), 
          "price_unit" => new xmlrpcval('20',"double"), 
         ); 


      $client = new xmlrpc_client($server_url . "/xmlrpc/object"); 
      $client->setSSLVerifyPeer(0); 

      $msg = new xmlrpcmsg('execute'); 
      $msg->addParam(new xmlrpcval($dbname, "string")); 
      $msg->addParam(new xmlrpcval($uid, "int")); 
      $msg->addParam(new xmlrpcval($password, "string")); 
      $msg->addParam(new xmlrpcval("account.invoice.line", "string")); 
      $msg->addParam(new xmlrpcval("create", "string")); 
      $msg->addParam(new xmlrpcval($val, "struct")); 
      $response = $client->send($msg); 

回答

0

這裏是我用於從順序創建的發票的方法和我使用odoo。

public function createInvoiceFromDraft() 
    { 
     $saleId = $_REQUEST['customerid']; 

     $OERP = new OpenERP(); 
     $OERPUserId = $OERP->login($_SESSION['OERP-username'], $_SESSION['OERP-password']); 

//workflow for confirming the order 
     $r = $OERP->workflow('sale.order', 'order_confirm', $saleId); 


     $result = $OERP->workflow('sale.order', 'manual_invoice', $saleId); 

     $fields = array('name'); 
     $readName = $OERP->searchread(array(array('id','=',$saleId)), 'sale.order', $fields); 
     $orderName = $readName[0]['name']; 


     $fields = array('id'); 
     $id = $OERP->searchread(array(array('origin','=',$orderName)), 'account.invoice', $fields); 
     $invoiceId = $id[0]['id'];  

     $result .= $OERP->workflow('account.invoice', 'invoice_open', $invoiceId); 

     return $result; 
    }