Posted By

JustGreg on 07/29/09


Tagged

xml-rpc OpenERP


Versions (?)

OpenERP: XML-RPC Web services (Example)


 / Published in: Python
 

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

Example of creation of a partner and his address.

  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)

Report this snippet  

You need to login to post a comment.