【问题标题】:Odoo How to develop a workflow in php for the invoice in XML-RPC?Odoo 如何在 php 中为 XML-RPC 中的发票开发工作流?
【发布时间】:2014-10-28 13:19:43
【问题描述】:

我尝试将我的电子商务平台发票推送到 odoo。 (php-xml-rpc) 发票已创建,但我还没有找到如何创建工作流来更改 Odoo 中的状态。

我在互联网上找到了一些东西,但我认为它是旧的,它不适用于 Odoo,但适用于 OpenERP v6 或 7。

nb:链接:http://goo.gl/lBPWnG

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

你有什么想法吗?

谢谢

当我在 Odoo 中创建发票时,我在 XML-RPC 中的代码。

// **********************************
// 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);

【问题讨论】:

    标签: php workflow xml-rpc invoice odoo


    【解决方案1】:

    这是我用来从订单创建发票的方法,我正在使用 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;
        }
    

    【讨论】:

      猜你喜欢
      • 2019-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多