OdooWiki OCA HUB
Uncategorised License: LGPL-3

This modules enables the creation of GraphQL endpoints. In itself, it does nothing and must be used by a developer to create the GraphQL schema and resolvers using graphene, and expose them through a controller. An example is available in the graphql_demo module.

auto_awesome What this module does

AI-generated from the code · Odoo 17.0

This module provides the technical foundation for exposing Odoo data through GraphQL endpoints. It does not add any user-facing features on its own; developers use it to build custom GraphQL APIs and a built-in GraphiQL explorer page.

This module is a developer tool: it does not add menus, buttons, or business rules for everyday users. It enables the creation of GraphQL endpoints that other modules can use to expose Odoo data.

  • It provides a controller mixin that handles GraphQL requests, accepting queries in JSON, raw GraphQL, or form data, and returning JSON responses.
  • It includes a GraphiQL template, an interactive web page where developers can write and test GraphQL queries directly in the browser.
  • It offers an Odoo-aware resolver that automatically converts Odoo's False values to null (except for Boolean fields), converts datetimes to the user's timezone, and raises an error if a requested field does not exist on the model.
  • It depends on the Python libraries graphene and graphql_server.

Because it only provides the base infrastructure, no new screens or actions appear in Odoo. Its purpose is to be extended by other modules that define the actual GraphQL schema and resolvers. The module touches no specific Odoo models; it works with any model through the resolver.

Depends on

base

Required by other modules

Text generated by AI (DeepSeek) from reading the Odoo 17.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: 6 confirmed, 3 with no information of 9 versions.

Sources · Odoo 12.0

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

terminal Installation and usage

OCA documentation · Odoo 17.0

To use this module, you need to

  • create your graphene schema
  • create your controller to expose your GraphQL endpoint, and optionally a GraphiQL IDE.

This module does not attempt to expose the whole Odoo object model. This could be the purpose of another module based on this one. We believe however that it is preferable to expose a specific well tested endpoint for each customer, so as to reduce coupling by knowing precisely what is exposed and needs to be tested when upgrading Odoo.

To start working with this module, we recommend the following approach:

  • Learn GraphQL basics
  • Learn graphene, the python library used to create GraphQL schemas and resolvers.
  • Examine the graphql_demo module in this repo, copy it, adapt the controller to suit your needs (routes, authentication methods).
  • Start building your own schema and resolver.

Building your schema

The schema can be built using native graphene types. An odoo.addons.graphql_base.types.OdooObjectType is provided as a convenience. It is a graphene ObjectType with a default attribute resolver which:

  • converts False to None (except for Boolean types), to avoid Odoo's weird False strings being rendered as json "false";
  • adds the user timezone to Datetime fields;
  • raises an error if an attribute is absent to avoid field name typing errors.

Creating GraphQL controllers

The module provides an odoo.addons.graphql_base.GraphQLControllerMixin class to help you build GraphQL controllers providing GraphiQL and/or GraphQL endpoints.

from odoo import http
from odoo.addons.graphql_base import GraphQLControllerMixin

from ..schema import schema


class GraphQLController(http.Controller, GraphQLControllerMixin):

    # The GraphiQL route, providing an IDE for developers
    @http.route("/graphiql/demo", auth="user")
    def graphiql(self, **kwargs):
        return self._handle_graphiql_request(schema)

    # The graphql route, for applications.
    # Note csrf=False: you may want to apply extra security
    # (such as origin restrictions) to this route.
    @http.route("/graphql/demo", auth="user", csrf=False)
    def graphql(self, **kwargs):
        return self._handle_graphql_request(schema)

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.