ERPpeek, a tool for browsing OpenERP data from the command line
We have been rather busy implementing OpenERP for a number of our customers and I have been tweaking and customising and extending it all over the place. It is a great fun product to work with, very flexible and Python is a really nice language to use. One thing I have been finding is that as a developer I really want to know more about the fieldnames and field values that are stored behind the scenes on an object, I want a command line utility to allow me to inspect a particular document and figure out why it displays what it displays etc. There might be one out there somewhere, but I figured it would be more fun to write my own, so I did. The best way to show how it works is with an example
./erppeek.py -d testdb -u admin -p admin -m res.users 1
in it’s simplist form that will connect to an openerp server running on localhost, (port 8069) with username admin and password admin to a database called testdb. It will then return all fields for the model res.users with id 1 (which will be the admin user)
./erppeek.py --server 'http://myserver.com:8069' -d testdb -u admin -p admin -m res.partner 1 3 5
This connects to a remote server called myserver.com and returns all fields from partners 1, 3 and 5
./erppeek.py --server 'http://myserver.com:8069' -d testdb -u admin -p admin -m res.partner -f name -f city 1 3 5
and now we are using the -f field parameter to return just the name and city (and it always returns the id as well) of those partners
./erppeek.py --server 'http://myserver.com:8069' -d testdb -u admin -p admin -m res.partner -f name -f city -s "name like School" -s "city = Southampton"
This time it is not relying on us passing in a list of object IDs, but it is doing a search of the res.partner objects where the name field contains ‘School’ and the city field is equal to Southampton.
To grab a copy of this small but handy little utility please download it from launchpad and make it executable. It works fine on Ubuntu, and should work on most platforms with Python. Do let me know in the comments what you think of it and what else you would like it to do.
Security note – this does at the moment get you to enter a password on the command line, which means the password will be available in your bash history and other users on your computer looking at processes you are running. This doesn’t bother me much as I am only using it on local development databases with trivial passwords anyway, but you have been warned. If someone wants to help fix that then great.
Tags: OpenERP
This is a great tool. Non encrypted password is still a big security issue in enterprise environment.
Yes, this is a development tool that I use locally or over SSH, we tend to install OpenERP so that all access is over SSH or SSL so the passwords are encrypted in transit. There is also the base_crypt module which I haven’t really played with myself, but hashes the passwords in the database. There doesn’t appear to be a good challenge/response authentication option for OpenERP.
Very useful tool, just tested it and i like (since i’m a command line addicted to xD)
one thing, it will be nice if the ids arguments is optional, so we can get all lines from a table without having to specifiy the id, this is just a proposition.
Nice work
glad you like it! the ID parameter is optional, if you use a search instead, so you could do -s “id>0” to return everything of a particular model (which might take a while on big tables)
that’s nice, with a grep i can filter the output 🙂
thanks again
Hey,
thanks, good tool. Only didn’t success to use expl. in operator for search purpose, value everytime is string, so can’t use list and “not in” was parsed not right. Will try to fix it if you don’t have time.
[…] Alan Bell: ERPpeek, a tool for browsing OpenERP data from the command line (theopensourcerer.com) Share this:EmailPrintDiggFacebookRedditTwitterStumbleUponLike this:LikeBe the first to like this post. Categories: Configuration, Linux, Python, Ubuntu Tags: Command-line interface, Languages, OpenERP, PostgreSQL, Programming, Python, Servers, Wikipedia Comments (0) Trackbacks (0) Leave a comment Trackback […]
Thanks Alan thats a great code. One question, how can I enter data into ERP database from a form embedded on a website
Thanks once again
thanks, i love this cli…I think I can improve it
It already has been. It’s moved on a lot since this: http://erppeek.readthedocs.org/en/latest/