Odoo Odoo Development Custom Odoo Modules Python ERP

Introduction to Odoo Custom Module Development

A beginner-friendly guide to building your very first custom module in Odoo to extend the ERP's core functionalities.

6 min read

Introduction to Odoo Custom Module Development

Odoo Custom Module Banner

Odoo provides powerful default apps, but business requirements often call for custom features. Creating a custom module is the cleanest way to extend Odoo.


Step 1: Module Structure

Every Odoo module requires a specific directory structure. Assuming your addons path is /opt/odoo/addons:

cd /opt/odoo/addons
mkdir my_custom_module
cd my_custom_module

Required files:

  • __init__.py
  • __manifest__.py

Step 2: The Manifest File

The __manifest__.py file declares your module and its properties.

{
    'name': 'My Custom Module',
    'version': '1.0',
    'summary': 'Extends base Odoo functionality',
    'description': 'A detailed explanation of my module.',
    'author': 'DevsCodespace Team',
    'depends': ['base'],
    'data': [
        'security/ir.model.access.csv',
        'views/custom_view.xml',
    ],
    'installable': True,
    'application': True,
}

Step 3: Creating Models

Create a models directory.

mkdir models
touch models/__init__.py models/custom_model.py

models/custom_model.py:

from odoo import models, fields

class CustomModel(models.Model):
    _name = 'custom.model'
    _description = 'My Custom Model'

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

Update models/__init__.py:

from . import custom_model

Update root __init__.py:

from . import models

Step 4: Designing Views

Create a views directory.

mkdir views
touch views/custom_view.xml

views/custom_view.xml:

<odoo>
    <record id="view_custom_model_tree" model="ir.ui.view">
        <field name="name">custom.model.tree</field>
        <field name="model">custom.model</field>
        <field name="arch" type="xml">
            <tree>
                <field name="name"/>
                <field name="description"/>
            </tree>
        </field>
    </record>

    <record id="action_custom_model" model="ir.actions.act_window">
        <field name="name">Custom Models</field>
        <field name="res_model">custom.model</field>
        <field name="view_mode">tree,form</field>
    </record>

    <menuitem id="menu_custom_model_root" name="Custom Tools" sequence="10"/>
    <menuitem id="menu_custom_model" name="My Models" parent="menu_custom_model_root" action="action_custom_model"/>
</odoo>

Step 5: Security Restrictions

Create a security directory with ir.model.access.csv to allow users to interact with your new model.

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_custom_model_user,custom.model.user,model_custom_model,base.group_user,1,1,1,1

Step 6: Install Your Module

  1. Restart your Odoo server.
  2. Go to Odoo -> Apps.
  3. Remove the "Apps" filter and search for "My Custom Module".
  4. Click "Install".

✅ Done

Your custom Odoo module is now installed and active!

Found this helpful?

We write about what we build. If you need similar solutions for your business, let's talk.