Go-to-definition
Press F12 (or your IDE’s equivalent) to jump from a symbol to where it is declared. OdooLS resolves definitions for:- Python symbols — classes, functions, variables, and parameters
- Models — a string like
"res.partner"inself.env["res.partner"]jumps to the class that declares_name = "res.partner" - Fields —
self.partner_idjumps to thepartner_id = fields.Many2one(...)declaration on the model - XML IDs — a
refattribute in XML or aenv.ref("module.xml_id")call jumps to the<record id="xml_id" ...>definition - Module names in
__manifest__.py— a string in thedependslist jumps to that module’s__manifest__.py(added in 1.2.0) - Import statements —
from odoo.addons.sale.models.sale_order import SaleOrderjumps to the imported file or symbol (added in 1.2.0)
Special cases
display_name redirects to the compute method
display_name redirects to the compute method
Going to definition on a
display_name attribute does not land on the generic display_name field declaration. Instead, OdooLS redirects you to the _compute_display_name method (or equivalent) on the model that defines the display logic.String literals do not jump to `class str`
String literals do not jump to `class str`
Activating go-to-definition on a plain string literal (e.g., a comment value or an arbitrary string) does nothing — it will not redirect to the built-in
str class definition. Only strings that OdooLS can semantically resolve (model names, XML IDs, field names) produce a navigation result.Domain field strings jump to field declarations
Domain field strings jump to field declarations
String field names inside a search domain tuple — e.g.,
[("partner_id.name", "ilike", "Acme")] — support go-to-definition and will navigate to the field declaration on the relevant model.Find references
Use Find All References (Shift+F12 in VS Code) to locate every place a symbol is used. OdooLS tracks usages across Python files and XML data files, so you can see both Python code that references a record and XML files that use its ID.Document symbols
The Outline panel in your IDE (populated via the LSPtextDocument/documentSymbols request) shows a structured view of the current file. OdooLS includes:
- Classes — including Odoo models with their
_name - Functions and methods
- Assignments — module-level variables and field declarations
- XML records —
<record>elements are listed by theiridattribute when viewing XML files
Workspace symbols
Workspace symbol search (Ctrl+T in VS Code, or your IDE’s equivalent) lets you search for any named symbol across the entire project — not just the open file. (Added in 1.2.0) OdooLS indexes the following symbol types for workspace search:| Symbol type | Search format | Example |
|---|---|---|
| Python class / function | Plain name | SaleOrder |
| Odoo model name | Quoted string | "sale.order" |
| XML ID | xmlid. prefix | xmlid.sale.action_quotations |
Search examples
Workspace symbol search scans all indexed entry points except built-in and public stubs, keeping results focused on your actual project code and addon paths.
Module hover and navigation in manifests
In__manifest__.py files, each string in the depends list is a navigable symbol. (Added in 1.2.0)
- Go-to-definition jumps to the dependency module’s
__manifest__.py. - Hover shows the module’s full dependency tree (see Hover Information).