Build a new addon in Odoo V8 Part 1

Once I got Odoo installed from its GitHub source using an installation shell script, I was eager to make a sample custom add-on module work. The installation script can be customized easily to install a fresh Odoo application in Ubuntu from its 8.0 branch source code in GitHub.

The sample I chose is called Open Academy that was demonstrated in [Odoo Open Days: Developing V8 Backend modules ] ( by Raphael Collet. Its [source code.] ( was also posted in GitHub. Nonetheless, it still took some tries to make it work. This blog documents the first step that creates a simple working layout of the module.

In my installation, the setting of addons_path in odoo configuration file (/etc/odoo-server.conf) is as following:


Then inside the /opt/odoo/custom/addons directory, I created an openacademy directory that has the following contents:

The [sample source code in GitHub.] ( had some errors. I guess that Raphael might use a different version. As step one, I copied most content from the GitHub source code, revised them to make it run. All revised code are listed at the end of this blog.

To let my code find other odoo modules, I added the following line to the .profile of odoo user account (the account used to run Odoo).

export PYTHONPATH=/opt/odoo/odoo-server

When I re-started Odoo, it couldn’t find the newly created module. I changed all openacademy file mode to 755. Retarted Odoo, still failed.

It turned out that I need to turn on the Technical Feature and run Update Modules List to make it work. To turn on the technical feature, go to Settings –> Users, edit Adminstrator and click on Technical Feature. Then you can see “update Modules List” in the Modules menu. Click it.

Then in the Installed Modules, I was able to find Open Academy and install it. I could see the Open Academy at the top level menu, click it and then Course submenu, I was able to list courses (an empty list at the beginning) and create new courses as demonstrated by Raphael.

Source code the Python package file

    import Course ( I didn’t use the name)

    'name': 'Open Academy',
    'version': '1.0',
    'category': 'Tools',
    'summary': 'Courses, Sessions, Subscriptions',
    'description': """
Courses, Sessions, Subscriptions

This module manages the definition of course, the organization,
sessions, and the subscriptions of participants.
    'depends' : ['base'],
    'data' : ['view/menu.xml'],
    'images': [],
    'demo': [],
    'installable' : True,
    'application': True,
} this is the model class. I changed the import statement and the parent class name to match the current Odoo 8.0 version.

from openerp import models, fields

class Course(models.Model):
    _name = 'openacademy.course'

    name = fields.Char(string='Title', required=True)
    description = fields.Text()

The static directory is empty.


<?xml version="1.0" encoding="UTF-8"?>

        <menuitem name="Open Academy" id="menu_root" sequence="110"/>

        <menuitem name="General" id="menu_general" parent="menu_root"/>

        <record model="ir.actions.act_window" id="action_courses">
            <field name="name">Courses</field>
            <field name="res_model">openacademy.course</field>
            <field name="view_mode">tree,form</field>

        <menuitem name="Courses" id="menu_courses" parent="menu_general"
            sequence="1" action="action_courses"/>
Written on August 27, 2014