Odoo custom module development is the most common request I get from businesses that already run Odoo. The standard apps cover a lot, but every company has a process that doesn’t fit: an approval rule, a special report, a link to an outside system. After working across Odoo versions 8 to 19, I’ve learned that a custom module is easy to write and hard to write well. This guide covers when to build one, how to structure it, and the practices that keep it upgrade-safe.
When Should You Build a Custom Module?
Customize only when standard Odoo can’t do the job. Before writing any code, check these in order:
- Configuration: Can a setting, automated action or server action solve it?
- Odoo Studio or existing apps: Is there a standard module or an OCA (Odoo Community Association) module that already does it?
- Custom module: Only if the first two fail.
Every line of custom code is something you maintain through every upgrade. A smaller customization is almost always the better one.
Good reasons to build a module:
- Business rules like approval limits, pricing logic or custom validations
- New models for processes Odoo doesn’t cover, such as job cards, inspections or fleet requests
- Integrations with payment gateways, couriers, government portals or third-party APIs
- Custom reports, PDFs and dashboards
- Automations that connect several apps
Anatomy of an Odoo Module
A well-organized module follows a predictable layout:
rrg_sale_approval/
├── __init__.py
├── __manifest__.py
├── models/
│ ├── __init__.py
│ └── sale_order.py
├── views/
│ └── sale_order_views.xml
├── security/
│ └── ir.model.access.csv
├── data/
├── static/
└── tests/
The manifest declares the module name, version, dependencies and the files to load. Models hold the business logic, views define the interface, and security controls who can see and do what.
A Practical Example: Order Approval Rule
Here is a small, realistic customization: sales orders above a set amount need manager approval before they can be confirmed.
__manifest__.py
{
"name": "Sale Order Approval",
"version": "19.0.1.0.0",
"category": "Sales",
"depends": ["sale_management"],
"data": ["views/sale_order_views.xml"],
"license": "LGPL-3",
"installable": True,
}
models/sale_order.py
from odoo import api, fields, models
from odoo.exceptions import UserError
class SaleOrder(models.Model):
_inherit = "sale.order"
needs_approval = fields.Boolean(compute="_compute_needs_approval", store=True)
approved_by = fields.Many2one("res.users", readonly=True, copy=False)
@api.depends("amount_total")
def _compute_needs_approval(self):
limit = float(
self.env["ir.config_parameter"].sudo().get_param(
"rrg_sale_approval.limit", default=10000
)
)
for order in self:
order.needs_approval = order.amount_total > limit
def action_approve(self):
self.write({"approved_by": self.env.user.id})
def action_confirm(self):
for order in self:
if order.needs_approval and not order.approved_by:
raise UserError("This order needs manager approval before confirmation.")
return super().action_confirm()
views/sale_order_views.xml
<odoo>
<record id="view_order_form_approval" model="ir.ui.view">
<field name="name">sale.order.form.approval</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="partner_id" position="after">
<field name="needs_approval" invisible="1"/>
<field name="approved_by"/>
</field>
<button name="action_confirm" position="before">
<button name="action_approve" type="object" string="Approve"
invisible="not needs_approval or approved_by"
groups="sales_team.group_sale_manager"/>
</button>
</field>
</record>
</odoo>
This example shows the habits that matter most:
- Inherit, don’t overwrite.
_inheritextends the core model, andsuper()keeps the standard behavior working. - Use computed fields with
@api.dependsso values stay correct automatically. - Keep limits configurable through system parameters instead of hardcoding them.
- Restrict actions with groups so only managers can approve.
Always test code like this on your exact Odoo version, because view syntax and field names change between releases.
Best Practices for Upgrade-Safe Modules
Odoo releases a new major version every year, and poorly written modules make upgrades painful. These rules keep that cost low:
- Never edit core Odoo files. Always extend through inheritance.
- Depend only on what you need. Fewer dependencies means fewer upgrade conflicts.
- Prefer small, focused modules over one giant module that does everything.
- Write tests. Odoo’s test framework catches breakage before your users do.
- Use clear names and prefixes for custom models and fields to avoid clashes.
- Follow version changes. For example, newer versions use
<list>instead of<tree>and inlineinvisibleexpressions instead ofattrs. - Document the module with a short README explaining what it does and why it exists.
Performance and Database Considerations
Slow customizations usually come from the same few mistakes:
- Searching inside loops instead of using one batched
searchorread_group - Computed fields that are stored but depend on too many fields
- Missing database indexes on fields used heavily in searches
- Heavy logic in
createorwritethat runs on every save
Because Odoo runs on PostgreSQL, query design matters. Profile slow screens, add indexes where needed, and move heavy work into scheduled actions or queued jobs. On large databases, this tuning often matters more than the feature code itself.
Integrations and API Work
Many custom modules exist to connect Odoo with other systems. Odoo exposes external APIs (XML-RPC and JSON-RPC) and supports REST-style controllers, so you can connect:
- Payment gateways and banks
- Shipping and courier services
- eCommerce platforms and marketplaces
- Government e-invoicing portals
- CRMs, WhatsApp and other messaging tools
For reliable integrations, log every request and response, handle failures with retries, and never put credentials in code. Store them in system parameters or environment variables.
Custom Development vs Buying an App
| Factor | Custom module | Apps Store / OCA module |
|---|---|---|
| Fit to your process | Exact | Partial, may need tweaks |
| Upfront cost | Higher | Lower |
| Maintenance | You own it | Shared with the vendor or community |
| Upgrade effort | Depends on code quality | Often handled by the vendor |
| Best for | Unique workflows | Common requirements |
My rule: if an existing app covers 80% of the need, start there and customize the remaining 20%.
How I Approach a Custom Development Project
A clear process avoids scope creep and surprise costs:
- Discovery: Map the current process and the real problem, not just the requested feature.
- Scope and estimate: Define what is in and out of scope before development.
- Build on a staging database: Never develop directly on production.
- Test with real users: Walk through actual scenarios, not just happy paths.
- Deploy and train: Roll out carefully and show the team how to use it.
- Support: Keep the module maintained as Odoo and your business evolve.
Final Thoughts on Odoo Custom Module Development
Good Odoo custom module development is less about clever code and more about restraint: customize only what you must, extend instead of overwrite, and build with the next upgrade in mind. Done this way, your customizations become a lasting advantage instead of technical debt.
Need a Custom Odoo Module?
I build custom modules, integrations and dashboards for Odoo versions 8 to 19. Browse my projects, see my services, or contact me to discuss your requirements.