OpenERP Module Recording : A Complete How-to for XML/YML!

January 10, 2013 by
OpenERP Module Recording : A Complete How-to for XML/YML!

Hello Everyone.

Did you ever come across a need during OpenERP development where you had to record a bunch of xml data or yml records at once and you don't like doing xml programming? Yes, this has been happening to many OpenERP developers who want to develop modules quickly and do not like demo/data records creation by the means of xml each time for their modules.

Relax then, the answer is here! Its base_module_record module which does this for you. Sadly, this module is no more available in version 7.0.

The version 8.0 source is here.

If you have gone through OpenERP Technical training, you might know this module better. If you still don't know, keep reading. Keep reading evn if you know well.

Talking about this module, it allows you to create a new module without any development. It records all operations on objects during the recording session and produces a .ZIP module. So you can create your own module directly from the OpenERP client. It works for creating and updating existing records. It recomputes dependencies and links for all types of widgets (many2one, many2many, ...). It also supports workflows and demo/update data.

This should help you to easily create reusable and publishable modules for custom configurations and demo/testing data. How to use it: Here you go!!!! Download the module : https://code.launchpad.net/~serpentcs/server-env-tools/base_module_record For version 7, download the document from here : Download For version 6.1, see the information as follows:

Step 1 : First we will install the “base_record_module” from the addons

Click on SettingsModulesModules

Search the module name in the Name Field in the search view of modules:

OpenERP : Module Recorder

After searching by name you will get the icon and after clicking on “Install” button you can install this module.

 Step 2  After installing this module you will get two menus.

OpenERP : Module Recorder menus

 Settings – Customization – Module Creation – Export Customization as a Module

 Settings – Customization – Module Creation – Export Customization as a Data

 Step 3 : Do some creation or modification of records of some models from your system, these will turn into xml records. If you want to record your data as a Module with “data.xml” file and “__init__.py”, “__openerp__.py” files. then click on the “Export Customizations as a Module

it will look like :

OpenERP : Module recorder

Date : That is from which date we want to record the data.

Record only : For only created records or/and modified record.

Objects : It will ask about the objects from which object we want to record the data.

YAML : If you select this check box then it convert your recorded data in to the YML file and if you don't select this then data will be in the XML format.

After Clicking the “Record” Button you will see a nice window showing confirmation, module naming, etc. which will eventually be used for your __openerp__.py.

 OpenERP Module Recording

So fill up this informatoin and click on “Continue

 This means your OpenERP module has been recorded and it will ask for .ZIP file to save.

 OpenERP : Module recorder

And You can save the module as a ZIP file in your system.

Step 4 : Now if you want to record your data in YML or XML.

Click on “Export Customizations as Data” and you will see a nice window like below ( actually its wizard ).

OpenERP : Module recorder for yml

As show above it will ask for the

Date : That is from which date we want to record the data.

Record only : for only created records or/and modified record.

Objects : It will ask about the objects from which object we want to record the data.

YAML : If you select this check box then it convert your recorded data in to the YML file and if you don't select this then data will be in the XML format.

In our case, tick this box.

 Lets see the results now!!!

 After clicking “Record” button it will display YML or XML formated data as per the our selection

(When not selecting the YAML Option)

OpenERP : Module Recorder for XML data

(When selecting the YAML Option)

OpenERP : Module Recorder for YML data

This is it!

Hope you have learnt another important module and this will help you develop you OpenERP modules faster.

If you want to get trained by our expert trainers, do contact us on contact@www.serpentcs.com.

Latest OpenERP trainings organized by SerpentCS are in Dubai, India, Sudan and Afghanistan.

You can see the feedback of our services here in our Testimonials page.

Thank you,

Serpent Consulting Services.