Objective
This workflow automatically imports product images from Google Drive and associates them with product models and variants in Odoo.
Main Features
- Identifies images stored in a specific Google Drive folder.
- Filters files to process only .png and .jpg images.
- Extracts information from file names to associate each image with a product or model in Odoo.
- Updates image fields in Odoo.
- Cleans up old images and notifies the completion of the process.
Workflow Steps
1. Triggering the Workflow
- Type:
Schedule Trigger
& Manual Trigger
- Details:
- Manually triggered via the "Click Manual" node.
- Automatically scheduled every 10 minutes via the "Schedule Trigger" node.
2. Finding Files in Google Drive
- Node:
Find Files
- Action: Searches for files in the specified Google Drive folder (
input
).
3. Filtering Images
- Node:
Filter Images
- Action: Only .png and .jpg images are kept for processing.
4. Decorating File Data
- Node:
Decorate Images
- Action: Extracts information from the file name to retrieve:
- The model (
model
).
- The SKU (
sku
).
5. Identifying Image Type
- Node:
Switch
- Action: Determines whether the image is for a product model (
template
) or a product variant (product
).
6. Searching for the Product or Model in Odoo
- Nodes:
Find Templates
: Searches for the product model in Odoo.
Find Products
: Searches for the product variant in Odoo.
7. Downloading and Converting Images
- Nodes:
Download Images Templates
: Downloads images for product models.
Download Images Products
: Downloads images for product variants.
Convert Base64 Images Templates
: Converts images to base64 format for Odoo.
Convert Base64 Images Products
: Converts images to base64 format for Odoo.
8. Updating Images in Odoo
- Nodes:
Update Images Templates
: Updates images for product models.
Update Images Products
: Updates images for product variants.
9. Cleaning and Finalizing the Process
- Nodes:
Search Old Images
: Searches for old images in the destination folder.
Drop Old Images
: Deletes outdated images.
Move Images
: Moves processed images to a done
folder on Google Drive.
10. Sending Process Completion Notification
- Nodes:
Sum Images
: Counts the total number of processed images.
Announce
: Sends a Google Chat notification with the total imported images.
Required Configuration
1. Connectors & API Credentials
- Google Drive API (OAuth2) with the necessary permissions to access files.
- Odoo API with permissions to read and update product models and variants.
2. File Naming Structure
Files must be named as follows:
<model>_<sku>.<png|jpg>
Example:
- Product Model:
template_12345.jpg
- Product Variant:
product_67890.png
Data Flow Summary
- A trigger (manual or automatic) initiates the process.
- The workflow fetches image files from Google Drive.
- It filters and identifies the images to be processed.
- It extracts the necessary information (model, SKU).
- Each image is associated with a product or model in Odoo.
- Images are downloaded, converted, and updated in Odoo.
- Old images are deleted, and new ones are moved to the processed folder.
- A notification is sent upon completion.
Use Cases
- Automating product image imports for Odoo.
- Updating images without manual intervention.
- Centralizing images on Google Drive before integrating them into Odoo.