OpenERP: XML-RPC Web services (Example)


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

Example of creation of a partner and his address.


Copy this code and paste it in your HTML
  1. import xmlrpclib
  2.  
  3. sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
  4. uid = 1
  5. pwd = 'demo'
  6.  
  7. partner = {
  8. 'title': 'Monsieur',
  9. 'name': 'Fabien Pinckaers',
  10. 'lang': 'fr',
  11. 'active': True,
  12. }
  13.  
  14. partner_id = sock.execute(dbname, uid, pwd, 'res.partner', 'create', partner)
  15.  
  16. address = {
  17. 'partner_id': partner_id,
  18. 'type': 'default',
  19. 'street': 'Rue du vieux chateau, 21',
  20. 'zip': '1457',
  21. 'city': 'Walhain',
  22. 'phone': '(+32)10.68.94.39',
  23. 'fax': '(+32)10.68.94.39',
  24. }
  25.  
  26. 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.