Understanding Regular Models in Odoo 19: A Complete Developer Guide
By Braincuber Team
Published on December 14, 2025
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 in building robust business applications.
In this comprehensive tutorial, we'll explore what Regular Models are, how they work, why they're important, and how you can leverage them effectively in your Odoo 19 development projects.
What Are Regular Models in Odoo 19?
Regular Models are the standard data models that store persistent data inside the PostgreSQL database. They represent real business entities such as Customers, Vendors, Products, Invoices, Employees, and virtually any business object you need to track.
Technically, Regular Models are defined by inheriting from models.Model:
from odoo import models, fields
class MyModel(models.Model):
_name = "my.model"
_description = "My Custom Model"
name = fields.Char("Name", required=True)
active = fields.Boolean("Active", default=True)
When you create a Regular Model, Odoo automatically generates a corresponding database table. The fields defined inside the model become the table's columns, making data persistence seamless.
Key Characteristics of Regular Models
1. Persistent Storage
Data created in a Regular Model is saved permanently in the PostgreSQL database. This makes them ideal for core business records like sales orders, purchase orders, inventory movements, and customer information that must persist across sessions and system restarts.
2. Full ORM Integration
The Odoo ORM (Object Relational Mapping) provides powerful features including:
- Automatic CRUD operations - Create, Read, Update, Delete without writing SQL
- Record rules and access control - Fine-grained security at the record level
- Business logic with Python methods - Override standard methods for custom behavior
- Relational fields - Link models using Many2one, One2many, and Many2many
- Computed fields - Automatically calculate values based on other fields
3. Business Logic Support
Regular Models allow developers to implement business rules using Python methods such as:
from odoo import models, fields, api
class SaleOrder(models.Model):
_inherit = "sale.order"
@api.model
def create(self, vals):
# Custom logic before creating record
if 'custom_field' not in vals:
vals['custom_field'] = self._generate_default()
return super().create(vals)
def write(self, vals):
# Custom logic before updating record
if 'state' in vals and vals['state'] == 'done':
self._send_notification()
return super().write(vals)
@api.onchange('partner_id')
def _onchange_partner(self):
# React to field changes in the UI
if self.partner_id:
self.payment_term_id = self.partner_id.property_payment_term_id
4. User Interface Integration
Every Regular Model automatically integrates with Odoo's view system:
- Form Views - For creating and editing individual records
- Tree/List Views - For displaying multiple records
- Kanban Views - For visual workflow management
- Search Views - For filtering and searching data
- Calendar, Gantt, Pivot Views - For specialized data visualization
Practical Example: Building a Student Model
Let's create a complete example of a Regular Model for managing student information:
from odoo import models, fields, api
from odoo.exceptions import ValidationError
class Student(models.Model):
_name = "school.student"
_description = "Student Information"
_order = "name"
name = fields.Char("Student Name", required=True)
student_id = fields.Char("Student ID", readonly=True, copy=False)
age = fields.Integer("Age")
date_of_birth = fields.Date("Date of Birth")
email = fields.Char("Email")
phone = fields.Char("Phone")
grade = fields.Selection([
('a', 'Grade A'),
('b', 'Grade B'),
('c', 'Grade C'),
('d', 'Grade D'),
('f', 'Grade F')
], string="Grade", default='c')
class_id = fields.Many2one('school.class', string="Class")
teacher_ids = fields.Many2many('school.teacher', string="Teachers")
active = fields.Boolean("Active", default=True)
notes = fields.Text("Notes")
@api.model
def create(self, vals):
# Auto-generate student ID
if not vals.get('student_id'):
vals['student_id'] = self.env['ir.sequence'].next_by_code('school.student')
return super().create(vals)
@api.constrains('age')
def _check_age(self):
for record in self:
if record.age and record.age < 0:
raise ValidationError("Age cannot be negative!")
In this example, Odoo automatically creates a database table named school_student with columns for each field. The ORM handles all database operations transparently.
Why Regular Models Matter in Odoo Development
Foundation of Business Data
Every Odoo application—Sales, CRM, Inventory, HR, Accounting—relies on Regular Models to maintain structured, persistent data. Understanding them is fundamental to any Odoo development work.
Easy Customization Through Inheritance
Developers can extend existing models without modifying core code:
class InheritPartner(models.Model):
_inherit = "res.partner"
# Add custom fields to existing model
customer_code = fields.Char("Customer Code")
loyalty_points = fields.Integer("Loyalty Points", default=0)
preferred_contact_method = fields.Selection([
('email', 'Email'),
('phone', 'Phone'),
('whatsapp', 'WhatsApp')
], string="Preferred Contact")
Powerful Data Relationships
Using relational fields like Many2one, One2many, and Many2many, Regular Models can represent complex business structures while maintaining referential integrity.
Built-in Security
Odoo provides fine-grained access control through:
- Access Rights (ir.model.access) - Control CRUD permissions per user group
- Record Rules (ir.rule) - Filter which records users can see/modify
- Field-level Security - Restrict access to specific fields
Best Practices for Regular Models
- Use meaningful _name attributes - Follow the convention
module.model - Always add _description - Helps with documentation and UI labels
- Define _order for default sorting - Improves user experience
- Use constraints for data validation - Ensure data integrity at the model level
- Leverage computed fields - Reduce redundant data storage
- Implement proper access control - Security should be designed from the start
Conclusion
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're building a custom module, extending existing functionality, or designing a complete business system, mastering Regular Models is essential for effective Odoo development.
Need Help with Odoo Development?
Our expert team can help you build custom Odoo modules, implement Regular Models, and optimize your ERP system for your business needs.
