OdooWiki OCA HUB

fastapi_endpoint_context

fastapi_endpoint_context folder_open OCA/rest-framework open_in_new
Uncategorised License: AGPL-3

This module provides an overridable request context for FastAPI endpoints.

It allows to customize the behavior of requests deep in the odoo call stack according to the current request context without having to override routers that may come from external modules.

This context contains by default the current endpoint app and id, respectively accessible via self.env.context.get('fastapi_endpoint_app') and self.env.context.get('fastapi_endpoint_id').

auto_awesome What this module does

AI-generated from the code · Odoo 18.0

Adds request context information to FastAPI endpoints so that the Odoo environment used during an API call knows which endpoint and app it belongs to.

This module extends the fastapi.endpoint model to make the Odoo environment aware of the current API request. When a FastAPI endpoint is called, the environment context is enriched with the endpoint's app and its database ID. This allows other modules to adapt their behaviour depending on which API endpoint is being used, without having to modify the endpoint code itself.

The module adds two methods to fastapi.endpoint: one that builds the context values (_get_app_context) and one that overrides the dependency used to create the Odoo environment (_get_app_dependencies_overrides). The context values are fastapi_app and fastapi_endpoint_id. Additionally, if a company is specified in the request, the context includes allow_company_ids to restrict access to that company.

There are no new menus, screens, or user-visible features. This is a technical module intended for developers building REST APIs with the FastAPI framework in Odoo. It changes how the environment is prepared for each API call, ensuring that the correct endpoint information is available throughout the call stack.

Depends on

Models and fields (1)
  • fastapi.endpoint · extends an existing model

Text generated by AI (DeepSeek) from reading the Odoo 18.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 2 confirmed, 7 with no information of 9 versions.

Sources · Odoo 16.0

Confirmed on 2026-11-03 in branch 16.0 of OCA/rest-framework.

terminal Installation and usage

OCA documentation · Odoo 18.0

odoo_env dependency is automatically overridden to include FastAPI endpoint context values.

You can override the fastapi.endpoint->_get_app_context() method to add custom values to the context for your applications.

No verified information in OCA: Installation, Configuration.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.