2015-09-04 103 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

你想开发什么? –