OpenERP 7 Development Environment Setup

Given that we have all the python libraries installed (installed from .deb), this section will focus on preparing the development environment on Eclipse IDE. Given that, we can start running OpenERP from Eclipse, and start digging and understand OpenERP under the hood.

Setup OpenERP from Latest Source Code

  • Create Local Repository Folder –> /opt/openerp7_repo
  • Create Installation Folder: –> /opt/openerp7

Install Eclipse

  • Requirement: Java 6 / Java 7, which are already preinstalled in Ubuntu
  • Download latest Eclipse Classic from http://www.eclipse.org/downloads/, i.e., eclipse-SDK-4.2.1-linux-gtk-x86_64.tar.gz
  • Unzip the package,
> sudo tar -xvf eclipse-SDK-4.2.1-linux-gtk-x86_64.tar.gz
  • Copy eclipse folder into /opt/eclipse
> sudo mv "eclipse" /opt
  • Lets add a link to the executable – ”/opt/eclipse/eclipse” in /usr/bin for easier access.
> sudo ln -s "/opt/eclipse/eclipse" /usr/bin/eclipse

We can start eclipse now by typing “sudo eclipse” in terminal. But let’s make it a bit more easy to access by adding the Launcher for Eclipse.

  • Create a new file application launcher file eclispe.desktop and keep it in folder, /usr/share/applications/
> sudo nano /usr/share/applications/eclipse.desktop
  • Add following parameters and save file.
[Desktop Entry]
Name=Eclipse IDE
Comment=Eclipse IDE
Exec=/opt/eclipse/eclipse
Terminal=false
Type=Application
Icon=/opt/eclipse/icon.xpm
Categories=Development;

You should now be able to launch Eclipse from the Launcher.

Install PyDev plugin for Eclipse

As we are doing Python programming, we are going to need the PyDev plugin installed.

  • Launch Eclipse
  • Create new workspace, i.e., /home/kittiu/workspace/openerp
    • To install PyDev plugin, open Eclipse,
    • Menu > Help > Install New Software…
    • Add software site, Name = PyDev, Site = http://pydev.org/updates/
    • Install PyDev

install_oe7_3

  • Restart Eclipse and open PyDev Perspective
  • On Menu > Window > Open Perspective > other, then choose PyDev

Next step, we need to tell Eclipse / PyDev, where the Python compiler is located.

  • Select Menu > Window > Preferences, then select, PyDev > Interpreter – Python
  • Click New…
    • Interpreter Name: Python27
    • Interpreter Executable: /usr/bin/python2.7

install_oe7_4

Now, Eclipse should be ready for Python / OpenERP development.

Download Latest OpenERP source code from launchpad.

In this step, we will be getting the OpenERP 7 source code which consist of 3 folders 1) addons 2) server 3) web. We will then create these source code folder as project in *openerp* workspace we created in the previous step.

We will be getting the source code into local repository first. This prove to be more convenient as we could do the cloning anytime without having to go to the OpenERP server every time.

Getting the source code

OpenERP use launchpad to keep its source code. It need Bzr software to communicate and pull the source code from server. As such, before we proceed to download the code, we will need to install the Bzr first.

> sudo apt-get install bzr
  • Use Bazaar to download 3 projects from the launchpad, 1) addons 2) server 3) web
> cd /opt/openerp7_repo
> bzr branch http://launchpad.net/openobject-addons/7.0 addons
> bzr branch http://launchpad.net/openobject-server/7.0 server
> bzr branch http://launchpad.net/openerp-web/7.0 web
  • Clone addons, server, and web project from /opt/openerp7_repo to /home/kittiu/workspace/openerp
> cd /home/kittiu/workspace/openerp
> bzr branch /opt/openerp7_repo/addons addons
> bzr branch /opt/openerp7_repo/server server
> bzr branch /opt/openerp7_repo/web web

Add the source code as new projects in Eclipse

  • In Eclipse,
    • Select Menu > File > New > PyDev Project
    • Create new project, 1) addons, 2) server and 3) web, which reference to the 3 folders respectively. The final view will be as following,

install_oe7_5

Running OpenERP from Eclipse

To run OpenERP is easy. To run it from command line, we can use the following command,

> python openerp-server --config=openerp-server.conf

Note:

  1. openerp-server is the executable, and is located in the server project, –config is an optional flag that will point to the configuration file.
  2. Running from the Eclipse is also note different. The only thing we will need to create manually is the openerp-server.conf file.
  • Create openerp-server.conf file with following parameters and locate it in the server folder.
[options]
; This is the password that allows database operations:
; admin_passwd = admin
db_host = localhost
db_port = 5432
db_user = openerp
db_password = openerppwd
addons_path = ../web/addons,../addons
log_level = info
xmlrpc_port = 7069

Note:

  1. We are providing some additional parameters,i.e., addons_path is telling location to load addons (modules), log_level = info and port is 7069 (instead of 8069).
  2. To learn more on possible parameters, execute, > python openerp-server –help
  • Create Run Configuration

install_oe7_6

  • Create new Python Run
Name: server openerp-server
Project: server
Main Module: ${workspace_loc:server/openerp-server}
Program Argument: --config=openerp-server.conf

install_oe7_7

  • Click Run to launch OpenERP. Note that on the successful launch, you will see something like this in the Console window,

install_oe7_8