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.