/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
username = 'admin' #the user pwd = 'admin' #the password of the user dbname = 'terp' #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': 'Fabien Pinckaers', 'lang': 'fr_FR', } partner_id = sock.execute(dbname, uid, pwd, 'res.partner', 'create', partner) address = { 'partner_id': partner_id, 'type' : 'default', 'street': 'Chaussée de Namur 40', 'zip': '1367', 'city': 'Grand-Rosière', 'phone': '+3281813700', 'fax': '+3281733501', } address_id = sock.execute(dbname, uid, pwd, 'res.partner.address', 'create', address)
URL: http://doc.openerp.com/developer/6_22_XML-RPC_web_services/