Monday, 15 April 2013

Example of xmlrpc and openerp

How to work with xmlrpc and OpenERP?

Here example of xmlrpc and openerp ....
save following file as

You can also create xmlrpc for the use of import or export data. Or you can also create a new records also.

Example : 
import xmlrpclib
username = 'admin'
password = 'a'
database = 'test_60A'
sock_comm = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/common')
uid = sock_comm.login(database,username,password)
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
print "connection success full"
ids = sock.execute(database,uid, password,'', 'search', [])
print "list of ids",ids
#ids will contain ids of company A and B
sock.execute(database,uid, password, '', 'write', ids, {'rml_header1': 'hop'})

start server and run file $  python

With workflow(invoice validate) :
sock.exec_workflow (dbname, 1, pwd, 'account.invoice', 'invoice_open', inv_id)

Here a example of connect with server and fetch list of ids of company and just call write operation you can do
the operation which needed..



  1. is this for use openerp with another database.?

  2. Hello, Its only external script written in python to do different operation.