QWeb Template Not Found Errors
QWeb is Odoo's template engine for reports, website pages, and kanban views. When a template cannot be found, you see:
ValueError: QWeb template 'my_module.report_template' not found
QWebException: Template 'web.assets_backend' not found
Element '' cannot be located in parent template 'account.report_invoice_document'Understanding QWeb Template Resolution
Odoo resolves QWeb templates by their XML ID (module.template_name). The template must be:
- Defined in an XML file with
t-nameattribute - The XML file must be listed in
__manifest__.pyunderdataorassets - The module must be installed and the template loaded into the database
Fix 1: Template Not Defined Correctly
Fix 2: XML File Not in Manifest
# Check __manifest__.py includes your template file
{
'name': 'My Module',
'data': [
'views/my_views.xml',
'reports/my_report_template.xml', # Must be listed!
],
}
# Common mistake: file exists but not in manifest
# The template will not be loaded into the databaseFix 3: Inherited Template Target Not Found
Custom content here
{
'depends': ['sale'], # Required!
}Fix 4: Stale Templates in Database
After uninstalling and reinstalling a module, templates may be stale:
# Find the template in database
sudo -u postgres psql -d mydb -c "
SELECT id, name, key, active FROM ir_ui_view
WHERE key = 'my_module.report_template';
"
# If it exists but is inactive:
sudo -u postgres psql -d mydb -c "
UPDATE ir_ui_view SET active = true
WHERE key = 'my_module.report_template';
"
# If it's missing, reinstall the module:
./odoo-bin -c /etc/odoo.conf -d mydb -i my_module --stop-after-initFix 5: Report Action Referencing Wrong Template
My Document
my.model
qweb-pdf
my_module.report_my_doc
my_module.report_my_doc
Fix 6: Website Template Issues
My Page
Debugging Template Issues
# List all QWeb templates for a module
sudo -u postgres psql -d mydb -c "
SELECT id, key, name, type, active
FROM ir_ui_view
WHERE key LIKE 'my_module.%' AND type = 'qweb';
"
# Check template content
sudo -u postgres psql -d mydb -c "
SELECT arch_db FROM ir_ui_view WHERE key = 'my_module.report_template';
"
# Force reload templates
./odoo-bin -c /etc/odoo.conf -d mydb -u my_module --stop-after-initPrevention
DeployMonkey's AI agent validates QWeb templates during module development. Template references, inheritance chains, and report actions are verified before deployment to prevent template-not-found errors.