首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Odoo如何在php中开发用于XML-RPC发票的工作流?

Odoo如何在php中开发用于XML-RPC发票的工作流?
EN

Stack Overflow用户
提问于 2014-10-28 21:19:43
回答 1查看 1.5K关注 0票数 0

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

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

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

代码语言:javascript
复制
//validate the invoice
echo "VALIDATE<BR /><BR />";
$conn->workflow('account.invoice', 'invoice_open', $invoice_id);

你有什么想法吗?

谢谢

我在Odoo中创建发票时使用XML-RPC编写的代码。

代码语言:javascript
复制
// **********************************
// 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);
EN

回答 1

Stack Overflow用户

发布于 2015-06-01 20:49:00

这是一个我用来从订单创建发票的方法,我正在使用odoo。

代码语言:javascript
复制
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;
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26609422

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档