You are currently browsing the category archive for the ‘OpenERP, PostgreSQL and SE-PostgreSQL’ category.

Download OpenERP All-In-One. It will be a file like openerp-allinone-setup-5.0.11.exe. This installer will include all three major components of OpenERP i.e, OpenERP Server, OpenERP Client and PostgreSQL. Install OpenERP by executing the exe file an OpenERP Client short cut will appear on the desktop. Click the shortcut and run the program. After Installation a screen like the one in the pic can be seen.

1st Screen After Installation of OpenERP All-In-One

To setup a new environment we need to create a new Database. For that click on File ->Databases -> New Dataabase. We will see a New Database Creation screen

Screen for creating new database

Fill the required fileds, like enter the Super Admin Password, the Database name, Administrator Password etc and click ok. After this you will be prompted that your database has been created with the user admin/admin (login/password).

Select a profile

Choose Minimal Profile in the profile field and click next. The next screen will ask you to enter your company information and your reports information.

Enter Your Company Information

Reprot information and logo of your company

Click next. From here you will to a Summary Screen. Click the Install button from the summary screen.

Summary Screen of Installation

This will end the installation process and the configuration screen will appear. Click the configuration button to start the configuration process.Installation Done, Configuration Starts. Click continue from the next screen. Than select Simplified Interface and click Set.

Simplified Interface in the Choose Your Mode Screen

Click continue from the next screen, and it will take you to user creation screen. From here we can either create a user of skip this step.

New User Creation Screen

Either create or skip this step. Than click continue from the next screen. After doing this we will see the following screen and with this our initial installation and configuration of OpenERP is completed.

Installation and Configuration Completed

We will start by creating a simple OpenERP module with only one form and one table in PostgreSQL database with no relations at all. Later on we will extend this simple module in more complex module with multiple forms, multiple tables and relations step by step. I assume that u have installed OpenERP All-In-One that includes OpenERP Server, OpenERP Web Client, OpenERP GTK Client and PostgreSQL and I assume that its configured and working fine.

I am using Ubuntu 9.10

    • Open terminal and write sudo nautilus. Than enter your password. A file browser window will open. Browse to the addons folder in the openerp-server. The path would be something like this e.g, /usr/local/lib/python2.6/dist-packages/openerp-server/addons/
    • create a new folder in it and name it “sim”, short for Student Information Management. Open the folder.
    • Create the following files in the sim folder.
      1. (its “double underscore init double”). Python file.
      2. __terp__py (its “double underscore terp double”). Python file.
      3. Python file
      4. sim_view.xml XML file.
    • Open file and write the following code.
import sim

sim is the name of our module that we are developing and its the name our major python file that will include all our python code. Save the file and exit

  • Open file and write the following code.
'name': 'Student Information Management',
'version': '0.1',
'category': 'Tools',
'description': """This module is for the Student Information Management.""",
'author': 'Mir Nauman Tahir',
'website': '',
'depends': ['base'],
'init_xml': [],
'update_xml': ['sim_view.xml'],
'demo_xml': [],
'installable': True,

You can write your own strings in “name, description,author and website”Save the file and exit

  • Now open file and write the following code.
class student(osv.osv):
    _name = "sim.student"
    _description = "This table is for keeping personal data of student"
    _columns = {
        'name': fields.char('Registration Number',size=256,required=True),
        'student_name': fields.char('Student Name',size=256,required=True),
        'father_name': fields.char('Father Name',size=256),
        'contact_no':fields.char('Contact Number',size=256)

This code will create a table in the database “student”. The value for _description can be any string of your choice. _column is a dictionary and contains all the column names of the table with their data types. In side the parenthesis is the caption for that field that will appear on the form, its size and “required=True” shows that its a must to enter this field. The “field.selection” creates a drop down list control that has two items, Male and Female. The “student()” shows the end of the class. Some precautions. Python is a language that works with indentation. One space extra or less can generate billions of errors and you wont get a proper clue, if you are not using the proper editor.

  • Open the sim_view.xml file and write the following code
<?xml version="1.0"?>
<!-- ============== student================= -->
<!-- 1st part of the sim_view start-->
<record model="ir.ui.view" id="student_form">
<field name="name">Student</field>
<field name="model">sim.student</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Student">
<field name="name"/>
<field name="student_name"/>
<field name="father_name"/>
<field name="gender"/>
<field name="contact_no"/>
<!-- 1st part of the sim_view end-->
<!--2nd part of the sim_view start-->
<record model="ir.ui.view" id="student_tree">
<field name="name">Student</field>
<field name="model">sim.student</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Student">
<field name="name"/>
<field name="student_name"/>
<field name="father_name"/>
<field name="gender"/>
<field name="contact_no"/>
<!--2nd part of the sim_view end-->
<!-- 3rd part of the sim_view start-->
<record model="ir.actions.act_window" id="action_student">
<field name="name">Student</field>
<field name="res_model">sim.student</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<!--3rd part of the sim_view end-->
<!--4th part of the sim_view start-->
<menuitem name="SIM/Student/StudentInfo" id="menu_sim_student" action="action_student"/>
<!--4th part of the sim_view end-->

From my perspective every view file for an OpenERP module will consist of atleast 3 or 4 parts

  1. The form part.
  2. The tree part.
  3. The action part.
  4. The menu part.

And thats how I have divided the above documents in 4 parts. Its not necessary that an OpenERP module must have all the above 4 parts. It can have form,action and menu parts or tree,action and menu or all the four parts. The 1st part will create a form view. It should be kept in mind that the <field name=”model”>sim.student</field>, the sim.student should be exactly the same as the value for the _name=”sim.student”. This refers to the sim_student table for which we are creating this form. The <field name=”type”>form</field> shows which view type it is, a tree or a form. The next important block is the <field name=”name”/>,<field name=”student_name”/>….. the values for the name here will be the exact column names from our file. The rest of the things don’t need much explanation for now. The 2nd part contain exactly the same things as the form view with very few differences like the type is tree here instead of form. And the column fields are encapsulated in the . This will create a grid type view displaying all the rows and column that are entered. This grid type view is called tree view. The 3rd part is the action. In res_model give the exact model name or the table name from our file, I.e “sim.student”. Specify a view_type that is form and view mode that is tree, form. The action defines when a menu is clicked for this action which form will it open. In the menu, id of this action will be used. The 4th part is related to creating the menu. A menu has the following important parts that are name,id,action and in some cases parent. There are two ways for creating a menu. I have used a way that I found more simple. “SIM/Student/StudentInfo”, SIM is the primary menu and appears in the left pane. When SIM is clicked Student menu will appear in the right pane. When student is clicked StudentInfo will appear and when StudentInfo is clicked it will open the form that is defined in the action for this menu. Save the file, exit. Now run OpenERP client. Install the current developed module and check it in working condition. More complexities to this tutorial will be added soon.

The objective is to install OpenERP and PostgreSQL on separate machines and configure them so that OpenERP can connect to the PostgreSQL running on the remote machine. We will go step by step

Here are the details of my environment.

PostgreSQL will be installed on fedora running in a virual machine.

OpenERP All-in-One (Server, Client and Web) installed on Windows XP SP2. Host OS.

STEPS on fedora VM

Run fedora VM than download the  graphical installer of PostgreSQL from for version 8.4.4-1.

Install postgresql-8.4.4-1-linux.bin from the terminal. If u get the error that the user is not in the sudoers file than add the user in the sudoers file using the following steps

when the installation completes it will give u PgAdminIII a GUI interface to perform all kinds of operation on the PostgreSQL databse. It will also create a default database by the name of “postgres” and a default user by the name of “postgres”. Password for the user “postgres ” will be set during installaion.

Click on Applications , than PosgresSQL 8.4, than PgAdmin III. The GUI will open.  Double click on the PostgreSQL 8.4 (localhost) server in the left pane of the GUI. The server will run and will show u Databases,Tablespaces, Group Roles,  Login Roles. Click on Databases, it will expand and will show u postgres database.

So far so good, now open the terminal and create another database by the name of testdb.

Open the terminal and write

Su postgres

This will change the user to postgres from ur current user

Createdb testdb

This will create a database named testdb.

Createuser nauman –P

U will be prompted for password. Lets say we keep the password “nauman”

Nauman is the user name for the above created database testdb and –P makes sure that u specify a password for the created user. When the user is also created than open PgAdmin III. U will see that the newly created database test db is created there.

Click on the testdb database to select it.

Click on tools from the main menue and click on Server Configurations. There we will find two file, postgresql.conf and pg_hba.conf. we have to edit both of these files one by one.

Open the postgresql.conf file and put a * in the “listen_addressess” string name. Save and exit. if the value is alteady * for “listen_addressess” than make no changes and exit the file.

Open the second file pg_hba.conf and make the following changes.

Double click on the checkbox that has no value infront of it. Another dialog box appears. Write the following

Enable checked

Type                      host

Database             ALL

User                      ALL

IP-Address   (write ur ip range)

Method                               trust

Click OK and exit the file.

Steps on host OS windows XP SP2

Download the OpenERP All-in-One (Server, Client and Web) for windows from

Install the OpenERP All-in-one. After installation do the following

Click on All Programes from the start menue. Than click on Openerp Server than click on Edit Config to open the openerp-server.conf file.

This is wat u will find in the file


without_demo = False

netport = 8070

server_actions_allow_code = False

secure = False

demo = {}

syslog = False

list_db = True

cache_timeout = 100000

port = 8069

reportgz = False

secure_pkey_file = server.pkey

netinterface =

log_level = info

admin_passwd = admin

smtp_port = 25

smtp_server = localhost

db_user = postgres

price_accuracy = 2

login_message = False

import_partial =

soap = False

pidfile = False

db_maxconn = 64

smtp_password = False

xmlrpc = True

db_port = 5432

debug_mode = False

netrpc = True

secure_cert_file = server.cert

interface =

logfile = C:\Program Files\OpenERP AllInOne\\Server\\openerp-server.log

csv_internal_sep = ,

pg_path = C:\Program Files\OpenERP AllInOne\\PostgreSQL\\bin

translate_modules = [‘all’]

stop_after_init = True

root_path = C:\Program Files\OpenERP AllInOne\Server

smtp_user = False

db_password = serg123

db_name = postgres

db_host =

assert_exit_level = warn

email_from = False

addons_path = C:\Program Files\OpenERP AllInOne\Server\addons


the values for the bold items will be edited like

db_user = nauman

give name of our created user

db_port = 5432

port should be kept the same if not changed

db_password = nauman

password for our created user

db_name = testdb

name of our created database

db_host =

IP of the machine that is running the PostgreSQL

Save the openerp-server.conf file with the above changes and exit.

now click on All Programmes from the start menue, go to OpenERP Server and click on start service.

Than start the OpenERP Client click on File from the main menue and click on connect.

The database is already selected in the list and cant be changed if the user that we have created is not a super user. Provide the password and click OK.

And that’s it. Our OpenERP is communicating with a PostgreSQL database that is running on a remote machine.

Mission Accomplished.

Blog Stats

  • 325,597 hits

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 233 other followers

%d bloggers like this: