Graphql Base

Base GraphQL/GraphiQL controller

  • Odoo Version

Graphql Base

Beta License: LGPL-3 OCA/rest-framework Translate me on Weblate Try me on Runbot

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.

Table of contents


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.

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.





This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainer:


This module is part of the OCA/rest-framework project on GitHub.

You are welcome to contribute. To learn how please visit

This is a preview of the recently viewed products by the user.
Once the user has seen at least one product this snippet will be visible.

Recently viewed Products