over 9 years ago
If you want to use WebServices
in OpenERP(Odoo) follow the below mentioned code and paste it in your WebServices XML-RPC
file:
- import xmlrpclib
- define HOST, PORT, DB, USER, PASS
- url = 'http://%s:%d/xmlrpc/common' % (HOST,PORT)
- sock = xmlrpclib.ServerProxy(url)
- uid = sock.login(DB,USER,PASS)
- print "Logged in as %s (uid:%d)" % (USER,uid)
- Create a new idea
- url = 'http://%s:%d/xmlrpc/object' % (HOST,PORT)
- sock = xmlrpclib.ServerProxy(url)
- args = {
- 'name' : 'Another idea',
- 'description' : 'This is another idea of mine',
- 'inventor_id': uid,
- }
- idea_id = sock.execute(DB,uid,PASS,'idea.idea','create',args)
import xmlrpclib define HOST, PORT, DB, USER, PASS url = 'http://%s:%d/xmlrpc/common' % (HOST,PORT) sock = xmlrpclib.ServerProxy(url) uid = sock.login(DB,USER,PASS) print "Logged in as %s (uid:%d)" % (USER,uid) Create a new idea url = 'http://%s:%d/xmlrpc/object' % (HOST,PORT) sock = xmlrpclib.ServerProxy(url) args = { 'name' : 'Another idea', 'description' : 'This is another idea of mine', 'inventor_id': uid, } idea_id = sock.execute(DB,uid,PASS,'idea.idea','create',args)
Note-> OpenERP is accessible through XML-RPC interfaces, for which libraries exist in many languages
0 Comment(s)