S3 Connector Tutorial

This page will provide a tutorial on setting up the S3 Connector and show an example of adding a file/porting existing files to S3

For a list of MIME TYPES please click here

Step 1 - Create API Credentials


If Using Amazon S3

Goto Amazon,

1) Click yourusername,

2) ClickMy Security Credentials,

3) ClickCreate New Access Key. Note down the Access Key and the Secret Key. You will need this to create the S3 Connector in Odoo.

If you are not using Amazon S3 you will be given a API URL and two keys, these are needed for the connector.

Step 2 -Install S3 Attachment Storage App

1) Goto your Odoo Instance and install the new S3 Attachment Storage App.

Step 3 -Setup User Access Permissions

1) Goto your user account and ensure that the PR1 S3 permission is set to PR1 S3 Admin User, this will Allow you to see the "All S3 Connections" menu if you do not see it.

Step 4 -Create S3 Connection

1) Click on All S3 Connections and ClickCreate

Step 5 -Fill in basic connection details

1) Enter a name for the connection, this should outline what this connection does, e.g.Partner Connection (JPG and PDF).
2) Enter yourS3 Bucket Name
3) Enter yourS3 Access Key/Secret Key that you got from Step 1 or your S3 provider.
4) If thisfield is visible leave this alone.
5) If you are using a provider that is not S3 please enter the url to the S3 API here e.g. https://mypovider.com, otherwise if you are using S3 LEAVE IT BLANK!!
6) HitSave

Step 6 -Bucket Filters

Bucket filters allow you to specifiy exactly which models and what types of attachments will be stored in this bucket.  For example you can state that the bucket only takes items from Contacts and Products and only takes PDF files. 
Note you do NOT have to state a mime type, if no mime type is stated the connector will upload ALL files associated with that model to S3.
The example above is showing how to enter for Contact (res.partner) and it will catch all PDF and PNG files. All other types of files on the Contact object will not be uploaded to S3.
If you do not enter a bucket filter you can tick the fallback option. This will ensure that all files go into S3, this isNOT recommended since Odoo functions better with its JS CSS etc stored within its own system.
To Create a bucket filter:
1) ClickAdd an Item
2)Search for the model (in this case it is contact (res.partner))
3) Enter a comma seperated list ofmime types that you wish this Connector to upload.
4) HitSave & Close or Save & New depending on if you need to add more.

It is possible to have multiple S3 connections to multiple buckets, each bucket could be sperated to only store specific file types. E.g. The example above could only have application/pdf in it. If another connection was created for another S3 bucket then it could have the mime type set to image/png. This would mean you would have two buckets, one that held PDF files and one that held PNG files. 

Step 7 -A Note On Sub Folder

Following on from Step 6 above, you can have connections with the SAME bucket but different Sub Folders.
A sub folder is where the connection stores all its files under within that bucket. In the example above (at the end of step 6) two connections could be created, both with testodoobucket as the bucket name, however the first one could have PDFs as the sub folder and the second one could have PNGImages as its sub folder. Each connection would then ensure that its files were put under those specific sub folders.

It is really up to you the user with regards to how you wish to store your files.

Step 8 -Testing the connection

Next you need to test the connection, the system will not begin to start uploading files to an S3 storage node without the connection being first tested.
1) Upload any file (ideally a small file)
2) Click the Test Connection button. This will make the system upload the file to S3, it will then attempt to delete the file from S3. This tests all the necessary access permissions.
3) The Test Connected tick box should tick - if it does not please review the error message and check your credentials. Also the test file should be deleted from S3 and the Odoo Test File field on the current connection.
4) The system will now start uploading attachments (in this example of PDF and PNG of Res Partner) to S3.

Side Note -> If you wish to turn off the upload to S3 at any time simply untick the S3 Enabled tick box. - This will prevent any files from uploading to S3. If you wish at a later date to upload the files to S3 you can then click on Upload All Existing button (see below for more information) to upload the files that have not yet been uploaded to S3.

Step 9 -Uploading a File

1) Goto the object that you have enabled S3 on (in this example its Res.Partner). Goto Attachments and click Add
2) Note that the newly uploaded file has a link that is connected to Amazon.

Step 10 - Uploading Existing Files

To use the system to upload existing files to S3, simply goto the S3 Connection and press the Upload All Existing Button.
As you can see in the image above, the existing image in the RED URL is now uploaded securely to Amazon (See Green URL)