我需要將開放的erp hr模塊與php網站集成。爲此我嘗試使用XML-RPC。 但我沒有得到如何訪問它的method.I需要使用開放erp中的休假,時間表和工資計算。如何從PHP訪問OPENERP方法?
0
A
回答
1
0
您可以像訪問其他CRUD方法一樣訪問openerp中的方法。 它在openerp文檔中沒有記錄,但可以訪問模型中定義的方法。
將以下代碼添加到來自ttps://doc.openerp.com/6.1/developer/12_api/#xml-rpc-web-services的openerp_models.php文件中。下載提供的PHP LIB
<?php
public function call_openerp_func($model, $function, $ids) {
$client = new xmlrpc_client($this->server . "object");
$id_val = array();
$count = 0;
foreach ($ids as $id) {
$id_val[$count++] = new xmlrpcval($id, "int");
}
$this->msg = new xmlrpcmsg('execute');
$this->msg->addParam(new xmlrpcval($this->database, "string"));
$this->msg->addParam(new xmlrpcval($this->id, "int"));
$this->msg->addParam(new xmlrpcval($this->password, "string"));
$this->msg->addParam(new xmlrpcval($model, "string"));
$this->msg->addParam(new xmlrpcval($function, "string"));
$this->msg->addParam(new xmlrpcval($id_val, "array"));
//////
*/
// Functions return values
$this->res = &$this->client->send($this->msg);
if ($this->res->faultCode()) {
return 'Error: ' . $resp->faultString();
} else {
$res = $this->res->value();
return $res;
}
}
?>
這你如何調用上面的函數
<?php
// sample for calling function to validate invoice payment
$validate_voucher_payment = $kengen_model->call_function_func('account.voucher',
'button_proforma_voucher', array(8));
?>
希望這能解決你的問題
0
您可以嘗試使用
Python中使用Web服務,Ruby,PHP和Java編程語言
只需要按照低鏈
https://www.odoo.com/documentation/8.0/api_integration.html
我希望我的回答可以對你有所幫助:)
相關問題
- 1. 如何訪問模塊 - OpenERP web/http.py方法
- 2. 訪問PHP方法
- 3. 如何在Ubuntu上訪問Pgadmin3 - OpenErp
- 4. Xcode:如何從子類訪問方法?
- 5. 如何從UIViewController訪問drawrect方法?
- 6. 如何從classB訪問ClassA的方法?
- 7. 如何從類中訪問wpfusercontrol方法
- 8. PHP:如何從基礎對象的方法訪問子屬性?
- 9. 如何從PHP訪問#anchors?
- 10. 訪問PHP方法生成的方法
- 11. 如何訪問方法庫?
- 12. 如何訪問類方法?
- 13. 如何訪問方法
- 14. 如何訪問MembershipProvider.GetPassword方法
- 15. 如何訪問在方法
- 16. OpenERP創建方法返回訪問被拒絕錯誤
- 17. OpenERP - XML RPC(寫入方法 - PHP)
- 18. 如何從getConnection方法訪問主方法的值?
- 19. Lua&OO,如何從另一種方法訪問方法?
- 20. 如何從其他方法訪問java中的方法?
- 21. 如何從mongoose中的實例方法訪問靜態方法?
- 22. 訪問ORM模型/ OpenERP的
- 23. Openerp完全訪問組
- 24. 使用C訪問OpenERP#
- 25. OpenERP訪問數據庫
- 26. 訪問從靜態方法
- 27. Pywinauto從ListBoxWrapper訪問方法
- 28. 從EJB訪問ManagedBean方法
- 29. 從類方法訪問UINavigationController
- 30. 從Foxpro訪問COM方法
這是任何方式訪問和使用ORM方法從PHP頁面提交ERP的形式。 – user1196798 2012-02-21 07:20:44