Cloud Storage

The cloud storage integration allows to store chatter and email attachments on the Google Cloud or Microsoft Azure platform instead of the database’s server.

The module can be used to prevent large files from being uploaded to and downloaded from a database’s server or when a database requires more data storage.

注解

  • Files generated by Odoo (e.g., sales orders) and Documents/Sign app files are always stored on the database’s server.

  • A database’s storage limit depends on its hosting solution:

    • Odoo Online: 100 GB

    • Odoo.sh:

      • Shared hosting: 512 GB

      • Dedicated hosting: 4 TB

    • On-premise: limited by the infrastructure in place.

Google Cloud

First, register and sign in to Google Cloud.

Service account

  1. Open the navigation sidebar on the Google Cloud console, then go to IAM & Admin ‣ Service Accounts ‣ Create service account.

  2. Define a Service account name, click Create and continue, then Done.

    Creating a Google Cloud service account
  3. Note down the service account’s Email as it will be used during the cloud storage bucket configuration.

  4. Click the (Actions) button, then select Manage keys.

    Accessing the "Manage keys" action
  5. Go to Add key ‣ Create new key, select JSON as the Key type, and click Create. Store the downloaded JSON file containing the key securely. It will be used when configuring Odoo.

    Creating a Google Cloud service account's JSON key

Cloud storage bucket

  1. Open the navigation sidebar on the Google Cloud console, then go to Cloud Storage ‣ Buckets ‣ Create.

  2. Enter a bucket name following the bucket naming guidelines and note it down as it will be used when configuring Odoo.

  3. Configure the bucket as desired and click Create when done.

    Creating a bucket
  4. Click the (More actions) button, then select Edit access.

    Accessing the "Edit access" action of a Google Cloud storage bucket
  5. Click Add principal and paste the service account’s email in the New principals field.

  6. Select Storage Admin as Role under the Cloud Storage section and click Save.

    Adding a principal to a Google Cloud storage bucket

Odoo 配置

  1. Install the Cloud Storage Google module.

  2. Open the Settings app and select Cloud Storage in the navigation sidebar.

  3. Select Google Cloud Storage as the Cloud Storage Provider for new attachments.

  4. Enter the Google Bucket Name as previously set.

  5. Click Upload your file next to Google Service Account Key and select the downloaded JSON file.

  6. Set a Minimum File Size (bytes) for attachments to be stored on Google Cloud.

Microsoft Azure

First, register and sign it to Microsoft Azure.

App registration

  1. On the Microsoft Azure portal, search for the App registrations service and open it.

  2. Click New registration, enter an application Name, select Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) under Supported account types, and click Register.

    Registering a Microsoft Azure app
  3. Note down the Application (client) ID and Directory (tenant) ID as they will be used when configuring Odoo.

  4. Click Add a certificate or secret next to Client credentials, click New client secret, then Add.

重要

For security reasons, leave the Expires field on 180 days (6 months) or choose a shorter expiration interval. Before the secret expires, adding a new client secret and updating Odoo’s configuration with the new value is necessary.

  1. Copy the client secret’s Value and store it securely. It will be used when configuring Odoo.

    Adding a secret to a Microsoft Azure app

Storage account

  1. Search for the Storage accounts service, open it, and click Create.

  2. Click Create new below the Resource group field, enter a Name, and click OK.

  3. Enter a unique Storage account name and note it down as it will be used when configuring Odoo.

  4. Configure the storage account as desired, and, when done, click Review + create, then Create.

    Creating a Microsoft Azure storage account

Container

  1. Open your storage account resource, for example by searching for its name, and select Containers under Data storage in the navigation sidebar.

  2. Enter a Name, note it down as it will be used when configuring Odoo, and click Create.

    Creating a Microsoft Azure storage container

Resource sharing

  1. Select Resource sharing (CORS) under Settings on the storage account’s navigation sidebar.

  2. Create a first CORS blob service rule:

    • Allowed origins: *

    • Allowed methods: GET

    • Allowed headers: Content-Type

    • Exposed headers: Content-Type

    • Max age: 0

  3. Create a second CORS blob service rule and click Save:

    • Allowed origins: *

    • Allowed methods: PUT

    • Allowed headers: content-type,x-ms-blob-type

    • Exposed headers: content-type,x-ms-blob-type

    • Max age: 0

    Creating Microsoft Azure storage account CORS rules

Role assignment

  1. Select Access control (IAM) on the storage account’s navigation sidebar, then click Add and select Add role assignment.

  2. Search for Storage Blobs Data Contributor and click Next.

    注解

    To remove the unnecessary delete permission, create a custom role and search for the custom role’s name instead.

  3. Click Select members, enter the name of the previously registered application, select it, and click Select.

  4. Click Review + assign twice.

    Adding a member to a container
Custom role

注解

This step is optional. However, removing the delete permission would prevent anyone managing to access the cloud storage’s credentials from deleting files.

  1. Open your subscription resource, for example by searching for its name, select Access control (IAM) in the navigation sidebar, click Add and select Add custom role.

  2. Select the JSON tab and click Edit. Copy the code below, add your subscription-id under assignableScopes and change the roleName (Custom role) if desired, paste it, and click Save.

{
    "properties": {
        "roleName": "Custom role",
        "description": "",
        "assignableScopes": [
            "/subscriptions/subscription-id"
        ],
        "permissions": [
            {
                "actions": ["Microsoft.Storage/storageAccounts/blobServices/generateUserDelegationKey/action"],
                "notActions": [],
                "dataActions": ["Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read", "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/add/action"],
                "notDataActions": []
            }
        ]
    }
}

Odoo 配置

  1. Install the Cloud Storage Azure module.

  2. Open the Settings app and select Cloud Storage in the navigation sidebar.

  3. Select Azure Cloud Azure as the Cloud Storage Provider for new attachments.

  4. Enter:

  5. Set a Minimum File Size (bytes) for attachments to be stored on Microsoft Azure.