Skip to content

OD502 data-file-not-loaded

A data file is listed under no manifest key Odoo reads, so Odoo never loads it.

Category Severity Series Needs the index
Quality Warning all no

What it reports

An XML data file, one whose root is <odoo>, <openerp> or <data>, or a CSV file, in a subdirectory of the module, that the manifest lists under no key Odoo loads in the module's series.

Series Keys Odoo loads, in order
up to saas~15.1 init_xml, update_xml, data, then demo_xml, demo
saas~15.2 to 18.x data, then demo
19.x init_xml, data, then demo
20.0 and later data, then demo

A module whose series is unknown is read with every key. The message names the keys the series loads, or, for a file listed only under a legacy key the series ignores, that key and the one to move the file to: demo for demo_xml, data for the others.

Why it matters

Odoo loads only the files the manifest lists under the keys it reads. Views, menus, access rows and records in any other file never reach the database, without an error or a warning: the module installs, and the screen or the access it was meant to add is simply not there. The cause is usually a new file not added to the manifest, a file renamed on disk but not in the list, which OD501 then reports too, or a module ported from an older series that still lists its files under init_xml or update_xml.

Files that are not meant for the manifest are left alone: those under tests/, i18n/, migrations/, upgrades/, doc/, docs/ and examples/, those at the module root, those the manifest lists under a key Odoo does not load, such as other_files, chart templates under data/template/, which Odoo reads from saas~16.2, and any file whose name appears in the module's Python code, which loads it itself. A file listed under a legacy key the series ignores is reported wherever it sits, even when other_files lists it too, as it was meant to load, unless it is a chart template or its name appears in the Python code. XML whose root is anything else, such as a QWeb <templates> file, is not a data file.

A manifest entry exempts a file only as an exact path relative to the module, in a list, a tuple or a set. Each of these is still reported: wizard/a.xml beside "data": ["views/a.xml"], as a shared base name is no match; "other_files": ["my_module/data/x.xml"], with the module prefix; and a file named only in assets, or under a key whose value is a string or a dict.

Example

__manifest__.py
{
    "name": "Library loans",
    "version": "18.0.1.0.0",
    "depends": ["base"],
    "data": ["security/ir.model.access.csv"],
}

The module ships views/library_loan_views.xml, but nothing loads it, so the loans have no list view.

__manifest__.py
{
    "name": "Library loans",
    "version": "18.0.1.0.0",
    "depends": ["base"],
    "data": [
        "security/ir.model.access.csv",
        "views/library_loan_views.xml",
    ],
}

Suppressing

The finding is on the file's first line, so in XML a trailing comment there covers it:

<odoo> <!-- odooscan: ignore[OD502] -->

For a CSV file, pass --ignore OD502, add it to ignore in the configuration file, or list the file in exclude.

See suppressing a finding.