OpenERP: XML-RPC Web services


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. username = 'admin' #the user
  2. pwd = 'admin' #the password of the user
  3. dbname = 'terp' #the database
  4.  
  5. # Get the uid
  6. sock_common = xmlrpclib.ServerProxy ('http://localhost:8069/xmlrpc/common')
  7. uid = sock_common.login(dbname, username, pwd)
  8.  
  9. #replace localhost with the address of the server
  10. sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
  11.  
  12. partner = {
  13. 'name': 'Fabien Pinckaers',
  14. 'lang': 'fr_FR',
  15. }
  16.  
  17. partner_id = sock.execute(dbname, uid, pwd, 'res.partner', 'create', partner)
  18.  
  19. address = {
  20. 'partner_id': partner_id,
  21. 'type' : 'default',
  22. 'street': 'Chaussée de Namur 40',
  23. 'zip': '1367',
  24. 'city': 'Grand-Rosière',
  25. 'phone': '+3281813700',
  26. 'fax': '+3281733501',
  27. }
  28.  
  29. address_id = sock.execute(dbname, uid, pwd, 'res.partner.address', 'create', address)

URL: http://doc.openerp.com/developer/6_22_XML-RPC_web_services/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.