Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Use XML-RPC of Odoo 8

    • 0
    • 0
    • 0
    • 0
    • 2
    • 0
    • 0
    • 0
    • 2.32k
    Comment on it

    XML-RPC is very useful in openerp. The XML-RPC protocol communicate to server and clients. XML-RPC is a very simple protocol which allows the client to do remote procedure calls. The called function, its arguments, and the result of the call are transported using HTTP and encoded using XML.

    EXAMPLE- Access server using XML-RPC in Odoo-8 to create partner and their address to use this code in openerp.

    import xmlrpclib
    
    username = 'admin' #the user
    pwd = 'admin'      #the password of the user
    dbname = 'YOUR_DB'    #the database
    
    # Get the uid
    sock_common = xmlrpclib.ServerProxy ('http://localhost:8069/xmlrpc/common')
    uid = sock_95;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': 'abc',
       'zip': '9876',
       'city': 'Greenland',
       'phone': '+987654321',
    }
    
    address_id = sock.execute(dbname, uid, pwd, 'res.partner.address', 'create', address)
    

 2 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: