How To Create A Custom Module in Odoo17
How To Create A Custom Module in Odoo17
Welcome to our tutorial on creating a custom module in Odoo 17! This guide will walk
you through the steps needed to build your first module from scratch. Whether you’re
new to Odoo development or just upgrading from a previous version, this tutorial is
designed to get you started quickly.
Odoo 17 Community Edition is the platform we’ll be using, and the development
environment has already been configured using PyCharm. If you haven’t set up your
environment yet, I recommend following a guide on configuring PyCharm with Odoo.
In this tutorial, we’ll cover the basics of module creation. We’ll start with setting up the
directory, creating essential files, and then testing our module in Odoo. Let’s dive in!
Our first step is to create a new directory inside the custom_addons folder. This
directory will serve as the base for our module.
For this tutorial, we’ll name the module demo_hospital . This naming convention helps
in identifying the purpose of the module at a glance. To create this directory:
This folder is now the base for our module, where we will store all the necessary files.
__init__.py : This file is used to import Python files within your module. We’ll
keep it empty for now, but it will be used later when we add more functionality to
the module.
__manifest__.py : This file contains metadata about the module, including its name,
version, dependencies, and more.
{
'name': 'Hospital Management',
'version': '1.0.0',
'category': 'Hospital',
'summary': 'Hospital Management System',
'description': """
A module to manage hospital operations including patient management,
appointments, billing, and more.
""",
'depends': [],
'data': [],
'demo': [],
'installable': True,
'auto_install': False,
'license': 'LGPL-3',
'application': True,
'sequence': -100,
}
This basic structure includes essential information like the module name, version,
category, summary, description, and more. You can customize the content based on the
specifics of your module.
With the basic module structure in place, it’s time to test it in Odoo.
1. Restart the Odoo service from PyCharm. This step ensures that the changes you’ve
made are recognized by Odoo.
2. Navigate to the Odoo UI in your web browser, go to the Apps menu, and click on
“Update Apps List.”
3. In the search bar, type “Hospital” to find your newly created module, “Hospital
Management.”
If you want your module to appear at the top of the list, ensure that the sequence value
in the __manifest__.py file is set to a lower number, such as -100 . This tells Odoo to
display your module first in the list.
Congratulations! You’ve successfully created and tested your first custom module in
Odoo 17. This module, though basic, lays the foundation for more complex
developments in Odoo. In future tutorials, we’ll explore how to add models, views,
menus, and other functionalities to your module.