OdooWiki OCA HUB

Encryption data

data_encryption folder_open OCA/server-env open_in_new
Tools License: AGPL-3

This module allows to encrypt and decrypt data. This module is not usable by itself, it is a low level module which should work as a base for others. An example is the module server_environment_data_encryption

auto_awesome What this module does

AI-generated from the code · Odoo 18.0

This module stores sensitive data such as passwords and credentials in encrypted form, separated by environment (for example production or pre-production). It is a technical building block: it has no menu of its own and is meant to be used by other modules.

This is a low-level technical module. It adds a hidden data table, encrypted.data, that keeps encrypted values identified by a technical name and an environment label (for example prod or preprod). Each name/environment pair must be unique, so the same key cannot be stored twice for the same environment.

  • Data can only be read or written with elevated (sudo) rights; normal users get an access error. The access rules grant no permissions to any group, so the table is not usable from the standard interface.
  • The encryption key is not stored in Odoo: it is read from the server configuration file, using an entry named after the environment. If that entry is missing, Odoo raises an error explaining what is needed.
  • If the environment cannot be determined from the configuration, an error is raised asking to check the running environment setting.
  • Values can be stored and retrieved as plain text or as JSON. When reading JSON, if the stored content is not valid JSON, a validation error is shown.
  • If a value was encrypted with a different key, decryption fails with a clear message saying the password is unreadable unless the old key is recovered.
  • Reading results are cached, and the cache is cleared after each save.

It touches only the encrypted.data model and depends on the base module. There are no menus, buttons, reports or scheduled actions.

Depends on

base

Required by other modules

Models and fields (1)
  • encrypted.data · new modelname, environment, encrypted_data

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: 5 confirmed, 4 with no information of 9 versions.

Sources · Odoo 16.0

Confirmed on 2026-11-03 in branch 16.0 of OCA/server-env.

terminal Installation and usage

OCA documentation · Odoo 18.0

To configure this module, you need to edit the main configuration file of your instance, and add a directive called running_env. Commonly used values are 'dev', 'test', 'production':

[options] running_env=dev

You also need to set the encryption key(s). The main idea is to have different encryption keys for your different environment, to avoid the possibility to retrieve crucial information from the production environment in a developement environment, for instance. So, if your running environment is 'dev':

[options] encryption_key_dev=fyeMIx9XVPBBky5XZeLDxVc9dFKy7Uzas3AoyMarHPA=

In the configuration file of your production environment, you may want to configure all your other environments encryption key. This way, from production you can encrypt and decrypt data for all environments.

You can generate keys with python -c 'from cryptography.fernet import Fernet; print(Fernet.generate_key())'.

No verified information in OCA: Installation, Usage.

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.