Skip to main content
OLS03xxx diagnostics validate Odoo-specific patterns: model inheritance, field definitions, domain syntax, and usage of deprecated APIs. Codes OLS033xx are deprecation warnings.

Model resolution

Default severity: ErrorMessage: This model is not in the dependencies of your module.You are accessing a model (typically via self.env['model.name'] or @api.returns) that belongs to a module not listed in the current module’s depends in __manifest__.py.Even if the model is present on your development database, it may not be installed in all environments. OdooLS enforces manifest-level dependency correctness.Fix: Add the module that declares the model to the depends list in your __manifest__.py.
Default severity: ErrorMessage: Unknown model. Check your addons pathOdooLS has no record of the model you are referencing. Either the model does not exist, or the module declaring it is not on any configured addon path.Fix: Verify the model name is correct, and ensure the addon that declares it is included in your addons_paths configuration.
Default severity: ErrorMessage: {0} is not in the dependencies of the moduleYou are importing a symbol from a module that is not declared as a dependency of the current Odoo module.Fix: Add the relevant module to depends in __manifest__.py.
Default severity: ErrorMessage: Model is inheriting from a model not declared in the dependencies of the module. Check the manifest.Your model uses _inherit to extend a model, but the module that declares that model is not listed in depends.
class MyExtension(models.Model):
    _inherit = 'sale.order'  # OLS03004 if 'sale' is not in depends
Fix: Add the module (e.g. sale) to depends in your __manifest__.py.
Default severity: ErrorMessage: This model is inherited, but never declared.OdooLS found classes that _inherit this model, but no class that originally declared it with only a _name. This suggests a missing base declaration.Fix: Ensure at least one class in your addon path has _name = 'your.model' without _inherit.
Default severity: WarningMessage: Model {0} is shadowing an existing model in dependenciesA class declares _name with a value that is already used by a model in a dependency module. This creates a new, separate model with the same technical name, which is almost never intentional.Fix: Use _inherit if you intend to extend the existing model. If you genuinely need a new model with a different name, rename it.
Default severity: InfoMessage: Models declared in a function are not supported by OdooLS. OdooLS will use it as a normal class for the rest of the function onlyOdooLS does not support Odoo model classes that are defined inside a function body. The model will be treated as a plain Python class, and Odoo-specific features (field resolution, domain checks, etc.) will not apply to it.Fix: Move the model class to the module-level scope.

Domain validation

Default severity: ErrorMessage: Domains should be a list of tuplesA domain expression must be a list. The value provided is not a list.
domain = ("active", "=", True)  # OLS03006: tuple, not a list
Fix: Wrap the domain in square brackets: [("active", "=", True)].
Default severity: ErrorMessage: Domain tuple should have 3 elementsEach leaf tuple in a domain must have exactly three elements: (field, operator, value).
domain = [("active",)]  # OLS03007: only 1 element
Fix: Provide all three elements: [("active", "=", True)].
Default severity: ErrorMessage: A String value in search domain tuple should be '&', '|' or '!'When a string appears as a standalone element (not inside a leaf tuple) in a domain, it must be one of the logical operators '&', '|', or '!'.Fix: Use one of the three valid logical operators, or move your string value inside a leaf tuple.
Default severity: ErrorMessage: Invalid comparison operatorThe operator in a domain leaf tuple is not one of the supported comparison operators.Valid operators: =, !=, >, >=, <, <=, =?, =like, like, not like, ilike, not ilike, =ilike, in, not in, child_of, parent_of, any, not anyFix: Replace the operator with a valid value from the list above.
Default severity: ErrorMessage: Missing tuple after a search domain operatorThe logical operators &, |, and ! must be followed by one or more leaf tuples or nested lists.
domain = ["&"]  # OLS03010: nothing follows the operator
Fix: Provide the required leaf tuples after the operator.
Default severity: ErrorMessage: Invalid search domain field: {0} is not a member of {1}The field name in a domain leaf tuple does not exist on the target model.Fix: Check the field name for typos and ensure it is declared on the model (or reachable via dot notation through a relational field).
Default severity: ErrorMessage: Invalid search domain field: Unknown date granularityWhen using dot notation on a Date or Datetime field to access a date part, the granularity name must be one of: year_number, quarter_number, month_number, iso_week_number, day_of_week, day_of_month, day_of_year, hour_number, minute_number, second_numberFix: Use a valid granularity name from the list above.
Default severity: ErrorMessage: Invalid search domain field: Invalid dot notationDot notation in a domain field path is only valid on Date/Datetime fields (for granularity) or on relational fields (Many2one, One2many, Many2many). This field does not support dot notation.Fix: Remove the dot notation, or ensure the field is a relational or date field. If using a relational field, also confirm the comodel is valid and reachable.

Field validation

Default severity: ErrorMessage: Field does not exist on model or not in dependenciesA field name referenced in a related keyword argument, or in @api.onchange, @api.depends, or @api.constrains, does not exist on the model or belongs to a module not in the dependency list.Fix: Correct the field name, or add the module that declares the field to depends in your manifest.
Default severity: ErrorMessage: Field comodel_name's value is not in dependenciesA relational field (Many2one, One2many, Many2many) specifies a comodel_name that exists, but the module declaring that model is not in the current module’s dependencies.Fix: Add the module that declares the comodel to depends in __manifest__.py.
Default severity: ErrorMessage: Field comodel_name's values is does not existThe model name given as comodel_name is not known to OdooLS at all.Fix: Check the model name for typos and ensure the declaring module is on an addon path.
Default severity: ErrorMessage: Method does not exist on current modelThe method name given as the compute, search, or inverse argument on a field does not exist on the model.
name = fields.Char(compute='_compute_missing')  # OLS03018 if method absent
Fix: Define the method on the model, or correct the name to match an existing method.
Default severity: ErrorMessage: Compute method not set to modify this fieldThe compute method is declared on multiple fields, but this particular field is not included in the set of fields the compute method is expected to modify.Fix: Add the field to the compute method’s inverse or ensure the compute method assigns a value to this field.
Default severity: ErrorMessage: Inverse field {0} does not exist on comodel {1}On a One2many field, the inverse_name argument names a field that does not exist on the specified comodel_name.Fix: Correct the inverse_name to an existing field on the comodel.
Default severity: ErrorMessage: Inverse field is neither a Many2one nor a Many2oneReference fieldOn a One2many field, the inverse_name field on the comodel must be a Many2one or Many2oneReference pointing back to the current model.Fix: Change the inverse_name field on the comodel to a Many2one targeting the current model.
Default severity: ErrorMessage: Inverse field {0} is not pointing to the current model {1}, but rather to {2}The inverse_name field on the comodel is a Many2one, but it points to a different model than the one declaring the One2many.Fix: Update the comodel_name of the inverse Many2one field to point to the correct model.

Deprecations (OLS033xx)

Default severity: WarningMessage: Deprecation Warning: Since 17.0: odoo.tests.common.Form is deprecated, use odoo.tests.FormForm was moved out of odoo.tests.common in Odoo 17.0. Importing it from the old location still works but is deprecated.
from odoo.tests.common import Form  # OLS03301
Fix: Update the import to use the new location:
from odoo.tests import Form
Default severity: WarningMessage: The active key is deprecatedThe active key used in this context is deprecated in the version of Odoo you are targeting.Fix: Remove the active key or replace it with the recommended alternative for your Odoo version.

Build docs developers (and LLMs) love