How to setup Odoo 9 and Odoo 8 development Envirnoment

This site has been moved to “requesttutorial.com

Hello All

In this tutorial I will show how to install Odoo 8 and Odoo 9, the setup mechanism is almost the same, I will let you know when there is something that is required by Odoo 9 but its almost the same for both versions of Odoo.

I will be writing this tutorial on Ubuntu 14.04 but you can also apply it to Ubuntu 12.04, I chose these versions for their stability and alot others but you can try it on any Flavor of Ubuntu (and Linux).

1. Set up System and Pre-requisite packages for Odoo

Lets First Update our repository and update all the packages by issuing the following commands

P.S.

Before we get started, you can just download a ready-made VM of Odoo 8 and Odoo 9 I created based on the Process below in case you want to save your self some time and the trouble.

The username of VM is odoo and its password is admin

btw I will be deleting Odoo 8 soon, because I dont have that much space on my google drive to keep all this stuff.

To do it Manually Follow the Process Below…

sudo apt-get update
sudo apt-get upgrade
01-apt-update

02-apt-upgrade

Now Lets install all the Pre-Requisites

sudo apt-get install git openssh-server graphviz ghostscript \
python-dateutil python-feedparser python-matplotlib \
python-ldap python-libxslt1 python-lxml python-mako \
python-openid python-psycopg2 python-pybabel python-pychart \
python-pydot python-pyparsing python-reportlab python-simplejson \
python-tz python-vatnumber python-vobject python-webdav \
python-werkzeug python-xlwt python-yaml python-imaging \
gcc python-dev mc bzr python-setuptools python-babel \
python-feedparser python-reportlab-accel python-zsi python-openssl \
python-egenix-mxdatetime python-jinja2 python-unittest2 python-mock \
python-docutils lptools make python-psutil python-paramiko poppler-utils \
python-pdftools python-scipy python-decorator python-requests python-pyPdf \
antiword postgresql postgresql-client postgresql-server-dev-9.3

03-packages

Some more packages for Odoo 9

sudo apt-get install build-essential libldap2-dev libsasl2-dev npm nodejs libxml2-dev libxslt1-dev libjpeg-dev python-pip gdebi

NodeJS and other stuff to Run Odoo website

sudo npm install -g less less-plugin-clean-css -y && sudo ln -s /usr/bin/nodejs /usr/bin/node

wkhtmltopdf to print odoo 8 and odoo 9 reports

cd /tmp && wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb && sudo gdebi -n wkhtmltox-0.12.2.1_linux-trusty-amd64.deb && rm wkhtmltox-0.12.2.1_linux-trusty-amd64.deb

sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin/ && sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin/

For Ubuntu 14.04 users, Install the Package “python-passlib” as ivan albizu just commented that its lack causes “error 500 Internal Server” Error. To Install this package simply type.

sudo apt-get install python-passlib

2. Setup Eclipse

  • If you haven’t Already, Click here to Download Eclipse. I recommend the Eclipse Luna version. Once Eclipse is Downloaded and Extracted. Launch it.
  • Now we need to install pydev. To do so Click Help -> Install New Software04-InstallNewSoftware
  • From the “Install” Dialog box, Click Add05-AddaRepo
  • In “Add Repository” dialog box, Type “pydev” in the “Name:” field and “http://pydev.org/updates” in “Location:” field and Click OK.06-pydevRepo
  • In Next Windows, uncheck “Show only the latest version of the available software“, You will get a list of available versions of pydev to select from, Select 2.7.5 version and click Next. If you dont fine pydev 2.7.5 check the note below.07-pydevVersion
  • NOTE:
    While I was trying to install pydev for odoo 9, I couldn’t find pydev 2.7.5, It only showed the 4.4 version. To work around this problem, Download pydev from this link. Extract the zip archive, The Repeat the steps of installing pydev by going to HELP -> Install New Software -> Click “Add” and this time instead of adding, pydev url, click the Local Button as show in the image below and navigate to the directory where you extracted pydev and click ok.
    pydev_local_croped
  • Next uncheck “Groups Items by category” and you will see the 2.7.5 version of pydev check it and carry on with the Rest of Installation.uncheck_group_item_cropped
  • Click Next again and In Next Windows from accept the license Agreement and and Click Finish and the Installation Process will begin.08-LicenceAgreement
  • Somewhere during installation you will be asked whether you trust the certificates of Aptana Pydev, Click “Select All” and Click OK to to exit the dialog box.09-certificate
  • Once pydev installation is Done. We need to setup the GIT repository in order to download Odoo Source code. To do so, Click Windows -> Open Perspective -> Other10-perspective
  • A Window will Open ask you to select a perspective. Click Git11-gitPerspective
  • In Next Windows Select “Clone a Git Repository12-gitClone
  • Here type “https://github.com/odoo/odoo.git“. The Rest of the Fields will get auto-fill, If not Do it according to the image below. Click Next13-gitRepoPaths
  • You will be presented which Branches you want to clone, You can see all of the versions of Odoo. Deselect All and and Select 8.0 or 9.0 or which ever you will to.odoo9_selection_cropped
  • In next windows Select the Directory where you want to clone the Source and Click Finish. The Cloning Process will begin. This Process may Take a while depending on the speed of you Internet.15-gitLocalSavePath16-cloneProcess
  • Once the Cloning is Done. We need to import the source in to Eclipse. To do So, First 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.10-perspective17-pydevPerspective
  • Next we Need to setup the Interpreter for python. To do so, 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 and setup paths and rest of environment variables. Click OK to Close this Windows once eclipse is done setting up Environment.18-pydevInterpreterSetup19-pydevInterpreterSelection
  • Now to import the source code into eclipse Click File -> Pydev Project. In project name type odoo (or which ever name you like). uncheck Use Default and click Browse and select the source directory as shown below and click Finish.20-NewProjectSettings
  • And you are done with Setting up Eclipse.

3. Setting up Odoo Configuration File

To create configure file for odoo type the following command

sudo nano /etc/openerp-server.conf

and then copy and paste the content below

[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/waqar/odoo/addons

21-OpenERPconfig

ctrl + o to save the file and ctrl + x to exit nano.

Note:

Replace the Path to addons with your own addons directory. If you have followed exactly what I did, You wont be needing to change any of the above configuration.

4. Configure PostgreSQL server

Now we need create a role in PostgreSql for the user that will be Running Eclipse (and the Odoo Server in return). In Normal cases the will be the current logged-in user i.e your username with which you login.

To do so Type

sudo su postgres
psql -t template1
template1=# create user waqar with superuser password ‘postgres’;
template1=# \q

and type “exit” to exit from postgres user.

22-PostgresRole

5. Running the Code

In Eclipse, Package Explorer, Right Click odoo.py and select Run As Python Run

23-RunningCode

The Server will start Running.

24-CodeRunning

Now to access the Webclient. Open your favorite Browser even if its Internet Explorer and type “localhost:8069” or “your IP Address:8069” and your done, Below the screen shot of Odoo 8.

24-webUI

Here the Screenshot of Odoo 9

Untitled

 Thats it. Do let me know If I am missing anything or I can add anything to it.

Advertisements

36 thoughts on “How to setup Odoo 9 and Odoo 8 development Envirnoment

  1. Thank you very much for the explanation. It is well understood.
    The only question is on the last screen:
    I add a database name and password, but I have a error 500 Internal Server.
    I din’t know that failure

    Thank you very much in advance!

    • I honestly never got this Error, I think you might have a previous version of OpenERP installed. You can try to solve it by clearing your Cookies and deleting user’s sessions. You will find them in your home Dir under the folder

      .local/share/Odoo/sessions

      delete the content of session folder by using command

      rm -rf .local/share/Odoo/sessions/*

      Let me know if this works.

      • Thank you very much for the reply.
        Yesterday I got it working. In the beginning of the article you mention it was for Ubuntu 12.04, and I’m doing with 14.04. The problem came from there. To fix it I added: sudo apt-get install python-passlib.
        Now I have Odoo running!
        Thanks, great post!

      • Glad to know its working, I will your add your Fix so that someone reading in near future might not have to go through the same problem 🙂

  2. I really don’t understand why people doing it this way. What’s the point do it manually instead of add one line of code into the /etc/apt/sources-list
    deb http://nightly.odoo.com/8.0/nightly/deb/ ./
    then apt-get update and apt-get install odoo.
    Whole process is fully automatic and I’ve never had any problems with.

  3. First I want to thank you for this tutu it is so helpfull , but I am having this error don t know why

    Exception in thread openerp.service.httpd:
    Traceback (most recent call last):
    File “/usr/lib/python2.7/threading.py”, line 810, in __bootstrap_inner
    self.run()
    File “/usr/lib/python2.7/threading.py”, line 763, in run
    self.__target(*self.__args, **self.__kwargs)
    File “/home/lamia/git/odoo/openerp/service/server.py”, line 282, in http_thread
    self.httpd = ThreadedWSGIServerReloadable(self.interface, self.port, app)
    File “/home/lamia/git/odoo/openerp/service/server.py”, line 92, in __init__
    handler=RequestHandler)
    File “/usr/lib/python2.7/dist-packages/werkzeug/serving.py”, line 410, in __init__
    HTTPServer.__init__(self, (host, int(port)), handler)
    File “/usr/lib/python2.7/SocketServer.py”, line 419, in __init__
    self.server_bind()
    File “/home/lamia/git/odoo/openerp/service/server.py”, line 102, in server_bind
    super(ThreadedWSGIServerReloadable, self).server_bind()
    File “/usr/lib/python2.7/BaseHTTPServer.py”, line 108, in server_bind
    SocketServer.TCPServer.server_bind(self)
    File “/usr/lib/python2.7/SocketServer.py”, line 430, in server_bind
    self.socket.bind(self.server_address)
    File “/usr/lib/python2.7/socket.py”, line 224, in meth
    return getattr(self._sock,name)(*args)
    error: [Errno 98] Address already in use

    • Read the very last line of the Error “error: [Errno 98] Address already in use” means the port on which you are trying to connect is already in use, means another instance of odoo is using this port. To solve this problem, kill the other instance. to do this type the following command

      ps aux | grep odoo

      this will return the all the running processes by the name of odoo, copy the pid of running and kill that process by using the following command

      sudo kill -9 PID

      Alternativly if you have previuosly odoo install and its up and running, you can stop it by issueing the following command

      sudo service odoo stop

      • thanks for your response, actually this is my first installation of odoo in ubuntu 14.04 that is odd to have this exception although I can access to odoo via the web browser. I tried the commands above but it gave me another error :Internal server error.

  4. Hi

    First of all, thank you for this tutorial, it was helpful for me.

    Just when I come to the postgreSQL Configuration, I can’t run the command :: create user waqar with superuser password ‘postgres’;.

    And that’s why I have this error when I try to run odoo Server:

    File “/home/ghandi/workspace/odoo/addons/bus/bus.py”, line 114, in loop
    with openerp.sql_db.db_connect(‘postgres’).cursor() as cr:
    File “/home/ghandi/workspace/odoo/openerp/sql_db.py”, line 571, in cursor
    return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized)
    File “/home/ghandi/workspace/odoo/openerp/sql_db.py”, line 181, in __init__
    self._cnx = pool.borrow(dsn)
    File “/home/ghandi/workspace/odoo/openerp/sql_db.py”, line 460, in _locked
    return fun(self, *args, **kwargs)
    File “/home/ghandi/workspace/odoo/openerp/sql_db.py”, line 522, in borrow
    result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection)
    File “/usr/lib/python2.7/dist-packages/psycopg2/__init__.py”, line 179, in connect
    connection_factory=connection_factory, async=async)
    OperationalError: FATAL: role “ghandi” does not exist

    Thank you very much

    • Sorry for replying so late, I just saw this comment, Weird How come I havent before :/ For your Error, You can read the Last Line “OperationalError: FATAL: role “ghandi” does not exist” It means you have not created the Role, You think you have but haven’t, This occurs due to Copying and pasting the commands directly from page and then running it, try to type the database part manually.

      A colleague of mine was also have the same problem. And he was also just copy pasting :p by typing it manually, He did it.

      • Thank you for your reply. Indeed what you said is correct.
        I managed this by using:
        # sudo su – postgres
        # createuser –createdb –username postgres –no-createrole –no-superuser –pwprompt ghandi

  5. It’s work for me, thx bro, but I want to install both odoo v8 and odoo master (v9) in the same server, but it’s not work. Although I have created different database and user for odoo master. Help pls.

    • Thanx for commenting, Well…I havent done anything like so far, So I dont know what to say, you can ask this question from odoo community but here are few things you can try…

      First use different ports for both server, e.g. odoo 8 xml rpc server runs on port 8069 and so will odoo 9, you will get a Port in Use Error if you want to use both, So change the port number of one of the servers.

      Next I think the database structure might conflict, but you already said that you are using different databases. I had the same issue when I was using Openerp 5 and odoo 8 together, I was in hurry so I moved one to a VM, but I never tried it again. You can and then you can post here on how you did it 🙂

      • Yes, I have used different port for xmlrpc_port ,
        xmlrpcs_port and netrpc_port 8070.

        Hehehe, yup, VM is my choice to solve this.

        Thx u for your respon.
        Rgds

    • Glad to know that 🙂 you can post the solution here so that many other benefit from it. JIC you can put the VM in bridge mode and then ssh -X into it and access everything, the File Manager, Eclipse etc on your host PC. I usually prefer this way as I dont have to switch back and forth.

  6. Hi Waqarafridi

    I can run odoo8 without any problems

    But when i try to run odoo9 I get this error: CRITICAL ? openerp.modules.module: Couldn’t load module web.

    Thats because its trying to read the path from odoo8 wich is: /home/hermanhy/git/odoo/openerp/addons but my odoo9 its saved here: /home/hermanhy/git/odoo9/openerp/addons

    in the openerp-server.conf its changed

    Thank You

    • You tried to run both on a single System, which you can’t (as far as I know), You have to run one version of Odoo on a single system, If you want to run both, you can use virtual Machines, I have already provided the links for the VMs that I created.

      Next you have changed that paths of Addons in /etc/openerp-server.conf but I think the problem is with the database as its still of OLD Odoo 8.

      • You Misread my previous comment, You should NOT run two versions of ODOO on the Same System, Either Running or even STOP odoo, they shouldn’t be on the same system, as a Solution, either use Virtual Machines or TRY (I haven’t done it my self yet, but theoretically it should work) make another user in the database for the version 9, I mean REPEAT the the whole database part for odoo with different database user, and when running odoo 9 pass the argument -c /path/to/odoo9/addons.

        Hope this will work, if it does, let me know also.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s