0% found this document useful (0 votes)
102 views4 pages

How To Create A Custom Module in Odoo17

This guide provides a step-by-step tutorial on creating a custom module in Odoo 17, specifically using the Community Edition and PyCharm as the development environment. It covers setting up the module directory, creating essential files like __init__.py and __manifest__.py, and testing the module in Odoo. The tutorial aims to help both new and experienced developers quickly get started with Odoo module development.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views4 pages

How To Create A Custom Module in Odoo17

This guide provides a step-by-step tutorial on creating a custom module in Odoo 17, specifically using the Community Edition and PyCharm as the development environment. It covers setting up the module directory, creating essential files like __init__.py and __manifest__.py, and testing the module in Odoo. The tutorial aims to help both new and experienced developers quickly get started with Odoo module development.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

How to Create a Custom Module in

Odoo 17: A Step-by-Step Guide


Divya Rai · Follow
3 min read · Aug 18, 2024

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!

Step 1: Setting Up the Module Directory

To begin, open PyCharm. I’ve created a folder named custom_addons within my


project, and it’s currently empty. This folder has already been added to the Odoo
configuration file under the addons path, which ensures Odoo recognizes any modules
placed here.

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:

1. Right-click on the custom_addons folder.

2. Select New > Directory .

3. Name the directory demo_hospital .

This folder is now the base for our module, where we will store all the necessary files.

Step 2: Creating Essential Files

Inside the demo_hospital folder, we need to create two critical


files: __init__.py and __manifest__.py . These files are mandatory for every Odoo
module and serve different purposes.

__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.

To create these files:

1. Right-click inside the demo_hospital folder.

2. Select New > Python File .

3. Name the file __init__.py .


Repeat the process to create the __manifest__.py file. This file should contain the
following structure:

{
'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.

Step 3: Testing the 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.

You might also like