Google Cloud Storage - Extended
Extends Odoo 19's native cloud_storage_google with immediate all-attachment upload, smart mimetype filtering, SHA1-based deduplication, and safe GCS blob deletion - all in the same transaction, no CRON wait.
Key Features
Everything missing from the base module, added without touching core code
Uploads every eligible binary attachment - not just chatter - to Google Cloud Storage. Covers form saves, generated reports, imports, and background code.
When an attachment is created, it is uploaded to GCS in the same transaction. The filestore is used only transiently - never accumulates.
Automatically excludes web-served file types (JS, CSS, HTML, JSON, XML, SVG) that add overhead without meaningful storage savings.
Before uploading, checks if the same file already exists in GCS (by SHA1 checksum). If found, reuses the existing blob - no duplicate storage cost.
GCS blobs are deleted only when the last attachment record referencing that URL is removed. Multiple records sharing a blob via dedup stay protected.
Files exceeding the sync size threshold and pre-installation historical attachments are handled by the scheduled action - fully compatible with cloud_storage_migration.
Base Module vs This Extension
| Capability | cloud_storage_google (base) | + storage_cloud_google_extended |
|---|---|---|
| Chatter / mail attachments | Yes | Yes |
| Form / report / import attachments | No | Yes - Immediate |
| Mimetype exclusion filter | No | Yes |
| File deduplication (SHA1) | No | Yes |
| Safe GCS blob deletion | No | Yes |
| cloud_storage_migration dedup | No | Yes |
How to Set Up Google Cloud Storage
A step-by-step guide to linking your Google Cloud Storage bucket with Odoo
- 1. Register & Sign In: Visit the Google Cloud Console and sign in with your Google account.
- 2. Create a Service Account:
- Go to IAM & Admin -> Service Accounts -> Create.
- Define a name and click Create and continue, then Done.
Create a new service account in Google Cloud IAM
- 3. Manage Keys:
- Click the three-dot Actions menu on your new service account.
- Select Manage Keys.
Open the Manage Keys panel for your service account
- 4. Create a JSON Key:
- Click Add Key -> Create new key -> choose JSON -> click Create.
- The credentials file will download automatically. Store it securely.
Download the JSON credentials file for the service account
- 5. Create a Cloud Storage Bucket:
- Go to Cloud Storage -> Buckets -> Create.
- Choose a unique bucket name and complete the creation wizard.
Create a dedicated GCS bucket for Odoo attachments
- 6. Edit Bucket Permissions:
- Click the three-dot menu next to your bucket and select Edit Access.
Open the bucket access editor
- 7. Grant Service Account Storage Admin Role:
- Under New principals, paste the service account email address.
- Set the role to Storage Admin.
- Click Save.
Assign the Storage Admin role to your service account
Required Python Library
Before using this module, make sure the Google authentication library is installed on your Odoo server:
pip install --upgrade google-auth
This library allows your Odoo server to authenticate with Google Cloud using the downloaded JSON service account key file.
Configure in Odoo & See It in Action
From Odoo settings to files landing in your GCS bucket
Configure Google Cloud Storage in Odoo Settings
Go to Settings -> General Settings -> Cloud Storage.
Select Google Cloud as the provider, enter your bucket name, and upload the JSON
credentials file downloaded from the Google Cloud Console. Odoo will authenticate
automatically. Set the minimum file size threshold (in bytes) to control which
attachments qualify for cloud upload.
Attach a File Through the Chatter
A PDF file is attached directly from the chatter on any Odoo record. The base
cloud_storage_google module handles chatter uploads natively, and this
extension ensures the same deduplication and safe-deletion logic applies.
The file reaches Google Cloud Storage in the same request, not after a CRON delay.
File Lands in Your GCS Bucket Immediately
Seconds after the chatter upload, the PDF appears in your Google Cloud Storage bucket
under the configured path. No manual migration step, no CRON wait - the blob is
created in the same transaction as the Odoo attachment record.
Automatic Upload for System-Generated Attachments
When Odoo generates a PDF attachment automatically - such as sending an invoice via
the Send & Print action - this extension intercepts the creation and
uploads the resulting PDF to GCS immediately. No user interaction required.
This is the key gap the base module leaves open: programmatic attachments are
now fully covered.
Invoice PDF Stored in GCS - Not in the Filestore
The invoice PDF generated by Odoo's Send action appears in your GCS bucket
alongside the chatter attachment. Your Odoo filestore stays clean - only the
cloud URL reference is kept in the database. If the same PDF is sent again,
deduplication reuses the existing GCS blob instead of creating a copy.
How It Works
Attachment lifecycle with this extension installed
Any source - form save, report, import, or chatter
Mimetype, file size, and res_id validated. Excluded types stay local.
SHA1 matched against existing cloud attachments. Match found: reuse URL.
File uploaded via signed URL. Record updated to type=cloud_storage.
Local copy removed on commit. Zero disk accumulation.
Get in Touch
Scan to chat with us instantly
Developer: Omar Nabil
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module