You are currently browsing the tag archive for the ‘Languages’ tag.

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.


1.Download the recovery image form the link below. Use this image in case of  recovering from a disaster. Recovery Image: from

2. Copy to /source/ directory.

3. Go to ‘vendor/htc/dream’  and run ‘./’, or  ./

4. Then, Then apply the following commands

5. source build/

6. $ lunch aosp_dream_us-eng

7. Compile the modified Android Source Code for the device

8. $ make -j

9. Now the generated files are

10. boot.img,

11. recovery.img,

12. system.img,

13. userdata.img

14.  These files will be located at

15. out/target/product/dream-open/

16.  Put device into FASTBOOT mode

17. reboot

18. power_on the device with BACK key pressed,

19.  It should show the driods on skateboard with fastboot text displayed.

20.  Make sure the cable with the device is connected.

21.  Now apply the following commands

22. sudo su

23. set path to fastboot

24. export PATH=/mydroid/out/host/linux-x86/bin/:$PATH

25.  Stop and start the server

26. adb kill-server

27. adb start-server

28.  Check the fastboot devices

29. #fastboot devices

30.  The above command will show you the fastboot devices.

31. HT94JLZ00002    fastboot

32.  Now apply the following command.

33. #fastboot -p dream-open -w flashall

34.  flashall will apply all the above listed img files one by one. but we can also do that manually by specifying the image file name. After this the flashing will start and our device will be loaded with our own modified source code.

Blog Stats

  • 338,226 hits

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

Join 234 other followers

%d bloggers like this: