✅ Clean Fix for the “Model Not in Registry” Error in Odoo Addons
Ever built a custom module in Odoo—only to get hit with a model-not-found error that stops everything?

Koderstory is a lean software company focused on building viable, straightforward products that empower small businesses to grow.
Yeah, we’ve been there too.
You’re customizing something simple—maybe extending product.category or tweaking how product.template behaves—and suddenly, Odoo throws this:
TypeError: Model 'product.template' does not exist in registry.
What gives?
In this post, we’ll walk you through why this happens, how we fixed it, and what you can do to prevent it from derailing your development. Let’s get into it.
🔍 What’s Actually Going Wrong?
You create a custom module like mycustom_categorycode that inherits from a core model:
_inherit = 'product.category'
You add the product module as a dependency. You hit install. And Odoo explodes with:
TypeError: Model 'product.template' does not exist in registry.
You double-check — the Product module is marked as installed. But here’s the kicker: Odoo never actually loaded it from disk.
Why? Because Odoo couldn’t see it in the first place.
🚨 Common Root Causes We’ve Seen
1. Incorrect or Missing addons_path
If your odoo.conf doesn’t list the Odoo Community addons first, Odoo can’t load core modules like product properly — even if the manifest says they're installed.
2. Stale .pyc Files
Compiled Python cache files (.pyc) from older builds can trick Odoo into loading outdated or partial code, breaking the registry.
3. Missing product in Your Manifest
Even if your code depends on product, missing it in depends will delay its load order. But note — even with the right manifest, it won’t matter if Odoo can’t find the folder.
✅ How to Fix It — Step-by-Step
1. Clear Out Old Compiled Files
This is your first cleanup step:
find /srv/erp/odoo_addons -name "*.pyc" -delete
find /srv/erp/odoo_addons -type d -name "__pycache__" -exec rm -rf {} +
These cached files can silently break your install flow. Clear them before every clean deployment.
2. Add the product Module to Your Manifest
In every custom module that uses product.template or product.category, confirm:
'depends': [
'base',
'product',
],
This ensures Odoo knows your module depends on the Product app and queues it to load first.
3. Fix Your addons_path Order
Open your odoo.conf and ensure it looks like this:
addons_path =
/srv/odoo_ce/addons, ; Odoo CE core modules (must be first)
/srv/odoo_enterprise/odoo/addons, ; Odoo EE modules (optional)
/srv/erp/odoo_addons ; Your custom modules
Then verify the path on disk:
ls /srv/odoo_ce/addons/product
# You should see __init__.py, models/, views/, etc.
4. Restart Your Services
Just to be sure everything reloads fresh:
sudo systemctl restart postgresql
sudo systemctl restart odoo
5. Update the Modules in the Correct Order
Use the CLI to force Odoo to load Product before your custom modules:
/srv/odoo_ce/odoo-bin \
-c /srv/erp/odoo.conf \
-d erp \
-u product,mycustom_categorycode \
--stop-after-init
In the logs, you should see something like:
Loading module product (...)
...
Loading module mycustom_categorycode
Loading module ....
Loading module ....
That’s how you know Odoo is loading your dependencies in the right order.
🎯 Final Thoughts
These errors are frustrating — but totally preventable once you know the root causes.
To recap:
✅ Clear
.pycand__pycache__✅ Declare
productin your module dependencies✅ Ensure
addons_pathpoints to core folders first✅ Restart clean, update in the right order
Once Odoo sees the Product module and loads its models, your custom addons that extend product.template or product.category will install smoothly.
This tiny fix can save you hours of confusion — and keep your development pipeline clean, reliable, and fast.
Running into issues with custom modules or multi-tenant ERP builds?
#koderstory #odoo #odootips #odooerror #pythondev #erpfixes #customaddons #odooindonesia




