2015-09-04 106 views
0

我已閱讀用於創建新記錄的Odoo文檔。它使用XML RPC。Odoo如何使用XML創建或更新記錄

final Integer id = (Integer)models.execute("execute_kw", asList(
db, uid, password, 
"res.partner", "create", 
asList(new HashMap() {{ put("name", "New Partner"); }}) 
)); 

所以有可能只使用XML消息創建新記錄。

謝謝。

回答

0

是的,這是可能的。這裏是documenttation

這裏是一個使用python文件創建客戶記錄的例子。

import xmlrpclib 

username = 'admin' #the user 
pwd = 'admin'  #the password of the user 
dbname = 'odoo' #the database 

# Get the uid 
sock_common = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/common') 
uid = sock_common.login(dbname, username, pwd) 

#replace localhost with the address of the server 
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object') 

partner = { 
    'name': 'atul arvind', 
    'phone': '8000111234' 
} 

partner_id = sock.execute(dbname, uid, pwd, 'res.partner', 'create', partner) 

它將返回新創建的記錄的ID。

希望它幫助。

+0

嗨,謝謝你的回覆。但我想使用普通的XML消息,因爲我沒有使用任何編程語言。那麼插入或更新記錄的XML消息是什麼?謝謝。沒有任何編程語言的 – sourabhgk

+0

? –

+0

你想開發什麼? –