We will show you in this tutorial, how to debug Odoo V9 / V8 from Eclipse IDE ( step by step ). We will be working on Ubuntu 14.04 for stability reasons, but you can use any other version.
Update the system and install necessary packages for Odoo :
First thing to do is to update your system, which let you get the newest versions of packages and their dependencies existing on your machine.
#sudo apt-get update #sudo apt-get upgrade
Then we should install the Prerequisites packages for Odoo :
#sudo apt-get install python-cups python-dateutil python-decorator python-docutils python-feedparser python-gdata python-geoip python-gevent python-imaging python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-passlib python-psutil python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-pypdf python-reportlab python-requests python-simplejson python-tz python-unicodecsv python-unittest2 python-vatnumber python-vobject python-werkzeug python-xlwt python-yaml wkhtmltopdf
To install wkhtmltopdf (a package that let you print reports in Odoo 8 & 9), you should run this commands :
#sudo wget http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb #sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb #sudo cp /usr/local/bin/wkhtmltopdf /usr/bin #sudo cp /usr/local/bin/wkhtmltoimage /usr/bin
For Ubuntu 14.04 users, you should install “python-passlib” package, to avoid “error 500 Internal Server” Error :
#sudo apt-get install python-passlib
Setup Eclipse :
Very Important : For me I used LiClipse is a very featured Eclipse (Provides a number of enhancements) for Linux with PyDev (Python) support, To install/run it : (A big thanks to arulmr)
LiClipse is the lightweight version of the most popular Eclipse IDE and it includes PyDev and Egit by default which will help python/django developers
To install it follow my article Liclipse (Eclipse) Installation on Ubuntu
Once LiClipse installation is Done. We need to setup the GIT repository in order to download Odoo Source code. To do so, Click Windows -> Open Perspective -> Other
A Window will Open ask you to select a perspective. Click Git
In Next Windows Select “Clone a Git Repository“
In th URI field type “https://github.com/odoo/odoo.git“ | In the Host field type “github.com“ | In the Repository path type “/odoo/odoo.git“. Click Next
You will be presented which Branches you want to clone, You can see all of the versions of Odoo. Select only 8.0 or 9.0 or which ever version you want.
In next windows Select the Directory where you want to clone the Source and Click Finish (We recommend Eclipse workspace : /home/workspace/odoo). The Cloning Process will begin. This Process may Take a while depending on the speed of your Internet.
Now we need to Setup eclipse’s Perspective to work with Python. To do so click Window -> Open Perspective -> Other and from the Window Select Pydev and Click OK.
To setup the Interpreter for python, Click Windows -> Preference and In the Left Pane, Select Pydev and the Interpreter Python and then Click Auto-Config on the Right side, The System will automatically detect Your python version. Click OK to Close this Windows once eclipse is done setting up Environment.
To dispaly your code in Eclipse Click File -> Pydev Project.
In project name type odoo the name you like. uncheck Use Default and click Browse and select the source directory (The directory that you specified earlier, where cloning the source. As an example we used /home/workspace/odoo ) and click Finish.
We Finished with setting up Eclipse for Odoo use.
Setting up Odoo Configuration File
You can create your own config file for Odoo like this one :
#sudo nano /etc/openerp-server.conf
Copy this content in the file :
[options] ; This is the password that allows database operations: ; admin_passwd = admin db_host = False db_port = False db_user = odoo db_password = False addons_path = /home/workspace/odoo/addons
( In addons_path you should use your own addons directory )
ctrl + o to save the file and ctrl + x to exit nano
To take this file in consideration go to the “Running the Code of Odoo from Eclipse” step.
Configure PostgreSQL server
Now we need to create a role in PostgreSql for the user that will be Running Eclipse.
Usually we use our current user
#sudo su postgres #psql -t template1 #template1=# create user usmanbek with superuser password 'postgres'; #template1=# \q
Running the Code of Odoo from Eclipse
To take the openerp-server.conf file in consideration, you should go to Eclipse openerp-server -> Run As -> Run Configuration.
In the argument tab click on Variables.
A select variable box appears. Click on Edit Variables.
A preferences box appears. Click on New.
A new box appears. Put whatever you want in “Name” field, Ex: Config file | In the “Value” field put : –config=/etc/openerp-server.conf
Choose the variable you have just created (for my case it’s Config file) and Click Ok
Finally you click on Run 🙂
Now to access the Webclient, type localhost:8069. You will see this page.
Congratulation, now you can develop Odoo modules easily