OpenERP Custom Sample Module Development – OpenERP Quick Start Guide

This article will explain the basic steps involved in developing custom OpenERP modules. It is a “Hello World” kind of guideline, therefore you won’t be able to find out all the theories behind OpenObject platform here. Instead you will get all the necessary information to get started with. Sample module given here is fully functional and tested on OpenERP version 6.0-RC2 (with Web Client on Chrome browser). You will be able to download the complete source code at the end of this article.

Module Description
The sample module we are going to develop is a simple Notebook application. It helps to take down notes and contains just three fields namely “Title”, “Note” and “Date” in its data model.

Module Structure
An OpenERP module consists of some basic elements as explained below. Note that what is explained here is only the basic files required and structure will be more complex in real world applications.


l l – contains the application logic and database table structure definition. – init script will load the application’s main python-module and related in application initialization. view_name.xml – contains the application interface definition and menu structure. – is the module descriptor file. In previous versions of OpenERP this was known as “”

File Contents
Even though there is no specific order, I am going to start with the main python class (module) of our OpenERP module. This will handle the core functionality of the module and also will generate the database table to store related data.

[ ]


size=30. required=True). [ ] 1 import notebook ? After that we define the view and menu structure of our module. [ notebook_view. osv import time class notebook(osv.xml ] 2 .date('Date').char('Title'.01 02 03 04 05 06 07 08 09 10 11 12 13 from osv import fields.text('Note'). 'note_date' : fields.osv): _name = "notebook" _description = "Simple Notebook" _columns = { 'title' : fields. } notebook() ? Next we import the python module we created in application initialization script. 'note' : fields.

view" id="notebook_tree_view"> <field name="name">notebook. "version" : "0.ui.ui.act_window" id="action_notebook_form" <field name="name">notebook</field> <field name="res_model">notebook</field> </record> <menuitem name="Notebook" icon="terp-project" id="notebook_menu" <menuitem name="Notes" parent="notebook_menu" id="notebook_menu_mainform" </data> Finally create the application descriptor as". "website" : "http://www. "init_xml" : ["notebook_view.actions.tree</field> <field name="model">notebook</field> <field name="type">tree</field> <field name="arch" type="xml"> <tree string="Notebook"> <field name="title"/> <field name="note"/> <field name="note_date"/> </tree> </field> </record> <record model="ir.0" encoding="utf-8"?> <openerp> <data> <record model="ir.ibcscorp. "depends" : ["base"]. "demo_xml" : [].01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 <?xml version="1. "author" : "Keerthi Bandara @ iBCScorp".1".form</field> <field name="model">notebook</field> <field name="type">form</field> <field name="arch" type="xml"> <form string="Notebook"> <field name="title"/> <field name="note"/> <field name="note_date"/> </form> </field> </record> ? <record model="ir. "update_xml" : []. [ __openerp__.xml"].view" id="notebook_form_view"> <field name="name">notebook. "description" : "Simple demo module". "category" : "Generic Modules/Others". "active": False. "installable": True } ? 3 .py ] 01 02 03 04 05 06 07 08 09 10 11 12 13 14 { "name" : "notebook".

then select the check box in front of the module and click “Apply Scheduled Upgrades” link. 4 . the message ”Loading. notebook. mark it for installation.g. Click on “Start update” to continue the installation.Packaging and Installing New Module To prepare your module for installation. Select newly created module archive and click “Import Module” button. Once you found the module. 2.” will be continuously displayed. even though your module is successfully imported. 1.. you can continue the installation by following the given path below. In that case simply close the message window and continue to next step. it will appear under OpenERP “Modules” list. you may simply compress the module directory into a zip archive ( Once your module archive is ready. Login to OpenERP admin view and open “Import Module” screen under “Modules” section in “Administration” area. It can be easily located by Searching for the module name. After importing new module. Note: Sometimes on OpenERP V6 (RC2).

Accessing Your Module After installing your module successfully. Share and Bookmark: Custom Module. openerp 5 . iBCScorp is always willing to help you in your OpenERP implementation project. Conclusion Motivation behind preparing this article was the difficulty I have faced in finding out a proper start up guide in custom OpenERP module development. Even official documentation appeared to be incomplete/inconsistent at the moment of writing this article. If you found this post useful just leave a comment and do not hesitate to contact us on any OpenERP related issue. The sample source code explained above is available here. As an OpenERP partner. Anyway there is a lot more to explore in OpenERP module development. it will appear on the home screen of your OpenERP client as follows.

Sign up to vote on this title
UsefulNot useful