Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. import xmlrpclib
  2.  
  3. username = 'admin' #the user
  4. pwd = 'admin' #the password of the user
  5. dbname = 'openerp' #the database
  6.  
  7. # Get the uid
  8. sock_common = xmlrpclib.ServerProxy ('http://localhost:8069/xmlrpc/common')
  9. uid = sock_common.login(dbname, username, pwd)
  10.  
  11. #replace localhost with the address of the server
  12. sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
  13. #THis will search all product from database.
  14. product_ids = sock.execute(dbname, uid, pwd, 'product.product', 'search', [])
  15. #This will read all product from that db with all fields.
  16. product_vals = sock.execute(dbname, uid, pwd, 'product.product', 'read', product_ids)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement