Format your pendrive / memory card from terminal


As I needed the same and I thought to share it too so that it can be useful to others. Its very quick now to format your pendrive / memory card in ubuntu through terminal.

First of all you need to know the name of your pendrive / memory card and the location they are mounted on.

Just type this command in the terninal.

 dmesg | tail

Test@Testing:~$ dmesg | tail
[ 85.526761] audit_printk_skb: 39 callbacks suppressed
[ 85.526765] type=1701 audit(1348983052.085:25): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=2221 comm=”chrome” reason=”seccomp” sig=0 syscall=20 ip=0xaa7416 code=0x50001
[ 102.219536] init: plymouth-stop pre-start process (2535) terminated with status 1
[ 626.271412] sd 10:0:0:0: [sdb] 3862528 512-byte logical blocks: (1.97 GB/1.84 GiB)
[ 626.277713] sd 10:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn’t support DPO or FUA
[ 626.296023] sdb: sdb1

Here sdb1 is the name of your pendrive / memory card.

Now next is to unmount this to begin our format process. so to do that just execute this command

sudo umount /dev/sdb1

you will need to enter your password here.

There are other options available you can choose according to your need . like:

mkfs, mkfs.cramfs, mkfs.ext3, mkfs.ext4dev, mkfs.msdos, mkfs.vfat,mkfs.bfs, mkfs.ext2, mkfs.ext4, mkfs.minix, mkfs.ntfs

Now enter the following command to format your pen drive with FAT32 partition.

sudo mkfs.vfat -n ‘Ubuntu’ -I /dev/sdb1

And your pendrive is ready too use !







Database Anonymization

Database Anonymization:

When you are in a live environment you always needs to share your database with someone for many purposes but also wants to be sure that your data should be kept confidential. OpenERP provides you an addon that will let you share your database with anyone without letting your confidential information leaked. The addons is “anonymization” i.e Database Anonymization


How it works ?

It simply replaces the fields data by ‘XXX’ characters and when you reverse the anonymization process it will replace the ‘XXX’ by the original content.
i.e Two process to follow.

1: Convert Normal Data ———> Anonymized data(XXX pattern)
2: Convert Anonymized data(XXX pattern) ———> Normal Data (reverse process)
First install ‘anonymization’ addon in your database . you will see three menus created under ‘Settings’ main menu

Settings/Database anonymization
Settings/Database anonymization/Anonymization History
Settings/Database anonymization/Anonymize database
Settings/Database anonymization/Anonymized Fields

1: Convert Normal Data ———> Anonymized data(XXX pattern)

So first you need to define the fields whose value you need to keep it as secret by going through the menu “Settings/Database anonymization/Anonymized Fields” after you finished defining the fields just go to the menu “Settings/Database anonymization/Anonymize database” i.e you will find a wizard ‘Anonymize database‘ to execute the operation. Before executing the anonymization process, you should make a backup of your and execute that wizard(wizard) you will see a button ‘Anonymize database‘ on the wizard, click the button and wait for few minutes… after the process is completed successfully you will have a wizard poped to save the result files. Don’t forget to save the resulting file to a safe place because you will not be able to revert the anonymization without this file. This file is also stored in the for eg: /home/nch directory. The absolute file path is: /home/nch/field_anonymization_functional_3.pickle

Anonymize _fields



So after this your values in the database will look something like this


2: Convert Anonymized data(XXX pattern) ———> Normal Data (reverse process)

To get your anonymized data back to normal values just re-execute the wizard “Anonymize database” and select the file from the path for eg:
/home/nch/field_anonymization_functional_3.pickle and click the button ‘Reverse the Database Anonymization’. after the operation is successfully executed you will receive the data back to normal values.


To see the History of these 2 steps performed you can check it through the menu ‘Settings/Database anonymization/Anonymization History’



Change_default in OpenERP

There are many useful features in OpenERP that is not either used by much people or may be they do not know about it or may be they heard about it but didn’t understand the functionality / working of these features. Let’s discuss it here… many more to come in the upcoming blogs…wait and watch

One of them is the CHANGE_DEFAULT attribute of a field.

Change_default: Whether or not the user can define default values on other fields depending on the value of the field having the change_default set.

This is one of the attribute that needs to be defined when you define your field for the OpenERP model (class). lets see an example

Class attribute_test(osv.osv):






zip: fields.char(‘zip’, size=64, change_default=True),

city:fields.char(‘zip’, size=64)



Now you would  have these fields displayed in your form view. Till here we saw the declaration of this attribute. now we see how we can use it

Now go to the field for which you want to set a default value, in our case its CITY enter the value for city say Gandhinagar, just right click on this field and select set as default (GTK Client ) or click set as default from the right panel(Web Client)  then you will see the ZIP field avaialble with a checkbox, tick that field and say OK. here say the field ZIP has a value 382024.  You have the option to set the default value for All users or just for your self.



Note 1: For web 6.1 the fields that are invisible / readonly / One2Many / Many2Many will not appear in set as default menu.

How the effect is known ?

So whenever you enter the value for the field ZIP as 382024 and hit a TAB to have the focus_out event triggered you will see the CITY is automatically field to Gandhinagar.

Note 2: You can place change_default attribute on more then one field but you can use only one of them to set the default value for the targeted field.


Gunicorn on OpenERP 6.1


Gunicorn ‘Green Unicorn’ is a Python WSGI HTTP Server for UNIX. It’s a pre-fork worker model ported from Ruby’s Unicorn project. The Gunicorn server is broadly compatible with various web frameworks, simply implemented, light on server resources, and fairly speedy.

How you can use Gunicorn to boost your OpenERP server performance. Down we see how we can configure to achieve the massive performance improvement on OpenERP Server.

As of 6.1 OpenERP server has the inbuilt support for WSGI and you just need to specify the configuration parameters

you will find a sample configuration file for OpenERP in this path of OpenERP server source code “6.1/server/”

for more Details you can visit

To run the OpenERP server via Gunicorn, change the appropriate settings below, in order to provide the parameters that would normally be passed in the command-line,
(at least `bind` and `conf[‘addons_path’]`), then execute:

 $ gunicorn openerp:wsgi.core.application -c

or if you want to run it behind a reverse proxy, add the line import openerp.wsgi.proxied  in this file and execute:

 $ gunicorn openerp:wsgi.proxied.application -c

import openerp

Standard OpenERP XML-RPC port is 8069

bind = ‘’

pidfile = ‘’

Gunicorn recommends 2-4 x number_of_cpu_cores, but you’ll want to vary this a bit to find the best for your particular work load.

workers = 4

Some application-wide initialization is needed.
on_starting = openerp.wsgi.core.on_starting
pre_request = openerp.wsgi.core.pre_request
post_request = openerp.wsgi.core.post_request

openerp request-response cycle can be quite long for big reports for example
timeout = 240

max_requests = 2000

Equivalent of –load command-line option

openerp.conf.server_wide_modules = [‘web’]

conf =

Path to the OpenERP Addons repository (comma-separated for multiple locations)

conf[‘addons_path’] = ‘/home/openerp/addons/trunk,/home/openerp/web/trunk/addons’

Optional database config if not using local socket
conf[‘db_name’] = ‘DBNAME’
conf[‘db_host’] = ‘localhost’
conf[‘db_user’] = ‘DB USER’
conf[‘db_port’] = DB PORT
conf[‘db_password’] = ‘YOUR DB PASSWORD’

OpenERP Log Level


conf[‘log_level’] = 20

If –static-http-enable is used, path for the static web directory
conf[‘static_http_document_root’] = ‘/var/www’

Just make this changes and get the massive performance speed on OpenERP 6.1



How to Generate a SSL certificate for OpenERP

To connect via xml-rpc secure protocol (8071) we need to generate a certificate and a private key file for the OpenERP . Below are the steps which can guide you to achieve this.

Step 1: Create a Directory eg: “SSL” under openerp-server/bin

Step 2: Go to “SSL” directory. cd ssl

Step 3: Generate Private key(pkey) as

execute command :   openssl genrsa – des3 -out server.pkey 2048

enter the details that is asked for.

Step 4: Certificate

execute command openssl req-new-key server.pkey -out server.csr

enter details that is asked for.

Step 5: copy the .pkey file:

cp server.pkey

enter password

Step 6: openssl rsa -in -out server.pkey

Step 7: Generate CA private key

openssl genrsa – des3 -out ca.pkey 2048

enter password (enter different password then before)

Step 8: Generate a certificate in x509 format

execute: openssl req-new -x509 -days 365 -key ca.pkey -out ca.crt

Enter details that is asked for.

Step 9: sign the pkey

openssl x509 -req -in server.csr -out server.crt -CA ca.crt -CAkey ca.pkey

-CAcreateserial -CAserial

Enter password same as entered in step 7

Step 10: start openerp server with –cert-file=YOUR .crt FILE PATH –pkey-

file=YOUR pkey FILE PATH

eg: server$ ./openerp-server –addons-path=../openobject-addons/ –cert-

file=bin/ssl/server.crt –pkey-file=bin/ssl/server.pkey


Naresh Soni(nch)

Team Lead, OpenERP Support / OPW

How to create OpenERP development Environment on windows

# This doc explains the steps to be taken 
# if you want to deploy openerp on windows or create openerp.exe for windows
# or want to create OpenERP Setup exe.
# Note : you can get all the packages from

Install following packages:1: Install python2.6.5
   Set environment path c:\python26

2: Install all in one pygtk package:  pygtk-all-in-one-2.22.5.win32-py2.6 (default instllation)
   Set environment variable
 Variable name: GTK_RUNTIME
 Variable value: C:\Python26\Lib\site-packages\gtk-2.0\runtime 

3: from download the "add_to_dist" folder which contains *.dlls
  set environment variable:
 Variable name: openerp_dlls
 Variable value: path to the folder "add_to_dist" 

4: Install setuptools-0.6c11.win32-py2.6

5: Install python-dateutil-1.5.win32
   (Note: you can create .win32.exe from python package using  
   >>>python bdist_wininst command it create python-dateutil-1.5.win32in dist directory)

6: Install pywin32-214.win32-py2.6

7: Install lxml-2.2.2.win32-py2.6

8: Install pydot-1.0.3.win32
     Note: you can create .win32.exe from python package using  
 >>>python bdist_wininst

Now your GTK client is ready to start from the command prompt like you do in linux

9: Install matplotlib-0.99.1.win32-py2.6

10: Install numpy-1.6.0-win32-superpack-python2.6

11: Install pyparsing-1.5.5.win32
   Note: you can create .win32.exe from python package using  
 >>>python bdist_wininst

12: Install pyOpenSSL-0.11.winxp32-py2.6

13: Install py2exe-0.6.9.win32-py2.6

14:Install nsis-2.46-setup.exe for creating auto installer

15: Copy libhippocanvas-1-0.dll and hippo.pyd of add_to_dist directory to C:\Python26\DLLs

start create exe use following command

15.  >>>path_to_openerp_client_dir>python py2exe

    it will take some time
    it create a build and dist directory in client then inside the dist dir you will find the openerp_X_Y.exe(x,y are version no)

16:To create a auto installer
 go to openerp client/
        right click on setup.nsi and select compile with nsis 
        this operation will take time and a setup installer will be created.


Naresh Soni(nch)

Team Lead, OpenERP Support / OPW


Automatic Lead creation in OpenERP 6.1



Lets first see what is LEAD ?


A lead represents a potential customer with whom you have not established a relationship yet. Usually a lead contains valuable information to realise future sales opportunities. However, the most common mistake is that such key information too often gets lost, because it is registered nowhere. And even when registered, it might still be difficult to track any activity for that lead, because the information is not at hand when you need it.

There are many companies / firm that needs to have such feature running in their sales department. Here I would like to discuss about how you can automatically manage your leads in OpenERP.

First create a database. Install Fetchmail module in your database to configure Incoming mail server. After installing fetchmail Install crm to manage leads.


Now go to Settings–>Configuration–>Email


Click on:Incoming Mail Servers and click New.


Enter the parameters for the Incoming server: Refer Screenshot


Incoming mail server



Note: Field Create a New Record: This is the field where you need to specify a model for which you want your incoming mail to create a new record. Rest fields are self explanatory.

Now click Test and Confirm button to test the connection. Additionally you can click Fetch Now button to fetch new incoming mails.

You can also check all the mails that are read by clicking on Messages on right side bar.

So to check whether your leads are generated or not go to Sales –>Sales–>Leads


you will see list of all new incoming mails generated as a lead (refer screenshot). So now you can directly work on them and get free from all your worries.