Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import xmlrpclib
- username = 'admin' #the user
- pwd = 'admin' #the password of the user
- dbname = 'openerp' #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')
- #THis will search all product from database.
- product_ids = sock.execute(dbname, uid, pwd, 'product.product', 'search', [])
- #This will read all product from that db with all fields.
- product_vals = sock.execute(dbname, uid, pwd, 'product.product', 'read', product_ids)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement