Enable Dark Mode!
overview-of-regular-models-in-odoo-19.jpg
By: Ramsina K

Overview of Regular Models in Odoo 19

Technical Odoo 19 Odoo Enterprises Odoo Community

Odoo 19 continues to evolve as a powerful and flexible business framework, offering developers an organized way to structure, store, and manage application data. At the heart of Odoo’s backend architecture lie its models. Among the different types—regular, transient, and abstract—Regular Models play the most essential role. They form the backbone of almost every business module, from Sales and Inventory to HR, Accounting, and custom applications.

In this blog, we will explore what Regular Models are, how they work, why they are important, and how developers can use them effectively in Odoo 19.

What Are Regular Models in Odoo 19?

Regular Models are the standard data models that store persistent data inside the database. They represent real business entities such as Customers, Vendors, Products, Invoices, Employees, and more.

Technically, Regular Models are defined using:

class MyModel(models.Model):
    _name = "my.model"

Whenever a Regular Model is created, Odoo automatically generates a corresponding database table with the same name. The fields defined inside the model become the table’s columns.

Key Characteristics of Regular Models

1. Persistent Storage

Data created in a Regular Model is saved permanently in the PostgreSQL database. This is why they are suitable for core business records—like sales orders, purchase orders, and stock moves.

2. Fully Integrated with Odoo ORM

The Odoo ORM (Object Relational Mapping) provides powerful features such as:

  • Automatic CRUD operations (Create, Read, Update, Delete)
  • Record rules and access control
  • Business logic with Python methods
  • Relational fields linking different models
  • On-change and compute logic

Developers rarely need to write raw SQL because the ORM handles most operations efficiently.

3. Support for Business Logic

Regular Models allow developers to add business rules easily using Python functions such as:

  • create()
  • write()
  • unlink()
  • compute methods
  • onchange methods

This makes it easier to build complex applications while maintaining clean, maintainable code.

4. User Interface Integration

Every Regular Model is automatically connected to Odoo views such as:

  • Form Views
  • Tree Views
  • Kanban Views
  • Search Views
  • Calendar / Gantt / Pivot Views

These UI components make the data accessible to end users across departments.

Example of a Regular Model in Odoo 19

Here is a simple example of defining a Regular Model:

from odoo import models, fields
class Student(models.Model):
    _name = "school.student"
    _description = "Student Information"
    name = fields.Char("Student Name", required=True)
    age = fields.Integer("Age")
    grade = fields.Selection([
        ('a', 'Grade A'),
        ('b', 'Grade B'),
        ('c', 'Grade C')
    ], "Grade")

In this example:

  • A database table named school_student is created.
  • The fields become columns in the table.
  • Odoo UI can automatically render forms and lists for this model.

Why Regular Models Are Important in Odoo Development

1. Foundation of All Business Data

Every app—Sales, CRM, Inventory, HR—relies on Regular Models to maintain clean and structured data.

2. Easy Customization

Developers can inherit existing models and extend features without modifying the core code:

class InheritPartner(models.Model):
    _inherit = "res.partner"
    customer_code = fields.Char("Customer Code")

This allows seamless customization.

3. Better Data Relationships

Using relational fields like Many2one, One2many, and Many2many, Regular Models can represent complex business structures easily.

4. Security and Access Control

Odoo gives fine-grained control through:

  • Access rights
  • Record rules
  • Model-level ACLs

Regular Models are the foundation of Odoo 19’s powerful framework. They store persistent business data, support robust business logic, and integrate seamlessly with Odoo’s UI and security layers. Whether you are building a custom module, extending existing functionality, or designing a full business system, understanding regular models is essential.

By mastering Regular Models, you can unlock the full potential of Odoo development and build applications that are scalable, intuitive, and aligned with real business workflows.

To read more about Overview of Abstract Models in Odoo 19, refer to our blog, Overview of Abstract Models in Odoo 19.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment



whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message