The Odoo JavaScript framework is the set of building blocks provided by theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/odoo/documentation/llms.txt
Use this file to discover all available pages before exploring further.
web/ addon to power all browser-side Odoo applications. At its heart, the web client is a single-page application (SPA) available at /web that manages routing, actions, and views without requiring full page reloads. All new development should use OWL (Odoo Web Library) components and native ES modules.
In Odoo terminology, frontend often refers to the public website and backend to the web client (
/web). This reference focuses on the web client (backend). The word component always refers to OWL components; widget refers to the older legacy system.Code Structure
Theweb/static/src folder is the root of all JavaScript, SCSS, and template source. Key subdirectories:
core/
Low-level utilities, registries, services, hooks, and the OWL environment setup.
fields/
All field components used in form, list, and other views.
views/
View components:
form, list, kanban, pivot, graph, and more.webclient/
The web client shell: navbar, user menu, action service, and breadcrumb management.
web/static/src can be imported using the @web prefix:
WebClient Architecture
The web client is an OWL application. Its root template is:- NavBar — top navigation bar with app switcher and user menu.
- ActionContainer — renders the current action (a client action or a view from
act_window). - MainComponentsContainer — displays all components registered in the
main_componentsregistry, allowing addons to inject top-level UI.
Environment
Every OWL component in the web client shares a commonenv object. Odoo extends the standard OWL environment with:
| Key | Type | Description |
|---|---|---|
qweb | object | Required by OWL — contains all loaded templates |
bus | EventBus | Global event bus for coordinating system events |
services | object | All active services (use useService to access) |
debug | string | Non-empty when debug mode is active |
_t | function | Translation function |
isSmall | boolean | true when screen width ≤ 767px (mobile mode) |
Building Blocks
Registries
Registries are ordered key/value maps that serve as the main extension point of the web client. To add a custom field component:Services
Services are long-lived singletons that provide framework features. They declare dependencies and are accessed in components viauseService:
orm, rpc, notification, action, dialog, user, and router.
Components and Hooks
Components are OWL class-based components. Hooks factorize lifecycle-dependent logic:Context
Two types of context exist in the web client:User Context
User Context
Available via the
user service, the user context contains:| Field | Type | Description |
|---|---|---|
allowed_company_ids | number[] | Active company IDs (first is the main company) |
lang | string | User language code, e.g. "en_US" |
tz | string | User timezone, e.g. "Europe/Brussels" |
Action Context
Action Context
Set via
ir.actions.act_window’s context field. To extend it programmatically:Python Expression Interpreter
The framework ships a built-in Python expression evaluator for evaluating view modifiers (domain filters,attrs, etc.) in the browser:
@web/core/py_js/py module exports tokenize, parse, parseExpr, evaluate, and evaluateExpr.
Domains
Use theDomain class to work with Odoo record filter conditions in JavaScript:
Domain.and(domains), Domain.or(domains), Domain.not(domain), Domain.combine(domains, operator).
Global Event Bus
Theenv.bus is an OWL EventBus for broadcasting system-level events:
| Event | Payload | When |
|---|---|---|
WEB_CLIENT_READY | — | Web client has been mounted |
ACTION_MANAGER:UI-UPDATED | update mode | Current action rendering complete |
ACTION_MANAGER:UPDATE | next rendering info | Action manager finished computing next interface |
MENUS:APP-CHANGED | — | The menu service’s current app has changed |
ROUTE_CHANGE | — | URL hash changed |
RPC:REQUEST | rpc id | RPC request started |
RPC:RESPONSE | rpc id | RPC request completed |
FOCUS-VIEW | — | The main view should focus itself |
CLEAR-CACHES | — | All internal caches should be cleared |
CLEAR-UNCOMMITTED-CHANGES | list of functions | Views with uncommitted changes should clear them |
Browser Object
Use thebrowser object instead of calling browser APIs directly, enabling easy test mocking:
Debug Mode
Debug mode (env.debug) activates developer tools and extra UI information:
debug=assets— disables minification and generates source maps for JavaScript debugging.debug=tests— loadsweb.assets_testsbundle containing test tours.