About Cloud Storage Solutions


Cloud Storage Solutions is an Odoo app to organize attachments, manage folders' trees and synchronize Odoo with the cloud storage solution(s) of your choice. The app introduces automatic algorithms to prepare directories for documents and integrate those with workflows of  Google Drive, OneDrive/SharePoint,  Nextcloud/ownCloud, and  DropBox.

Decide which Odoo document types should have their own folder trees. Flexibly create folder rules. Any Odoo model can be chosen.

Manage folders and attachments from a single view. Conveniently navigate through them. Search and download files one by one or in a batch.

Organize files of any Odoo object in a set of subfolders. Instantly access folders and files in the attachments box and in synced cloud interfaces. 

The module allows preparing directories and sending them to the cloud client of your choice (Google Drive, OneDrive/SharePoint,  Nextcloud/ownCloud, and  DropBox). Have as many connections as you need. A separate add-on for each client is required.

Rely on auto-synchronization between Odoo and cloud solutions based on scheduled jobs. No manual interaction is required.  

Control sync logs right in Odoo. Export and share those in case of any issues. Be notified of any client disconnections.

Set up rules to prepare folders based on Odoo Enterprise workspaces (). All features, including sharing, downloading, and signing, would work even after sync.

Files Manager Interface

Automatic regular sync

Multi synchronization

Bilateral sync

 
 




Concepts and Terms


Here you can find terms and add-ons icons that were used throughщге all documentation.

Odoo model – is a document type in Odoo (for example, Sale Order, Project, Contact).

Odoo object – is an Odoo record within an Odoo model (for example, S00032, Project XYZ, Abigail Peterson).

Folder - a key object in cloud storage solutions that represents a virtual location for the attachments and other sub-folders.

Folder rules – are the configurations, based on which the module generates folders by checking the settings and fields of models and objects.

Model-related rule – a folder rule, which is based on an Odoo model (for example, Sale Order, Purchase Order, Project, Contacts, Leads/Opportunities). The model-related folder rules state from what model the information should be extracted.

Workspace-related rule () - a folder rule, which is used to sync the files from the module Documents, which generates folders according to the workspace structure.

Single View Interface – the functional interface for internal users for managing folders and files.

Automatic folder – is a rule-based folder generated regularly, based on the scheduled job 'Prepare Cloud Folders'.

Manual folder – a folder, which was created by a user. Unlike automatic folders settings for each folder should be set manually. Usually serve as subfolders to automatic folders.

Attachment – is a special Odoo object, which serves for organizing and storing files in Odoo.

Attachments box – the standard Odoo interface for Odoo object form views, where attachments are displayed (available for downloading and uploading).

Default folder – manual folders with or without default attachments that would be auto-generated for a specific Odoo object folder, as soon as an object-related folder is created for the first time. Further folder refreshing will not result in generating default folders with default attachments.

Cloud client - is external software, which might be used to organize cloud storage. For example, Google Drive,  OneDrive/SharePoint, ownCloud/Nextcloud, and DropBox.

Direct sync - is the sync from Odoo to the cloud client. For example, when you add files to an attachments box of an object or its folder, it is the direct sync, that sends them to the cloud.

Backward sync – is the sync from the cloud client to Odoo. For example, when you add files to one of the synced object’s folders in the cloud client, it is the backward sync that fetches them and adds them to the related folders in Odoo.

Reverse sync – is the sync, that assumes getting back all items to Odoo and deleting the files from the cloud client. It takes place when a folder isn't anymore synced when you want to change the cloud client of previously synced files and folders, or when the sync is fully stopped (cloud is reset).

Sync logs - records, which provide useful information on the type of operations that were processed or completed. They help to detect an error, if any, and investigate the reasons for it.

Add-ons icons

Features introduced by add-ons are marked by these signs.

Google Drive Odoo Integration

The connector, to synchronize Odoo folders and attachments with Google Drive.

ownCloud/Nextcloud Odoo Integration

The connector, to synchronize Odoo folders and attachments with Nextcloud or/and ownCloud.

OneDrive/SharePoint Odoo Integration

The connector, to synchronize Odoo folders and attachments with OneDrive or/and SharePoint.

DropBox Odoo Integration

The connector, to synchronize Odoo folders and attachments with DropBox.

Cloud Sync for Enterprise Documents

An optional add-on to prepare workspace-related folders and to sync Odoo documents (introduced by the enterprise app 'Documents') with clouds.



Folders in Cloud Storage Solutions


A folder is a key object in cloud storage solutions, which represents a virtual location for the attachments and other sub-folders.

Folders serve for convenient file storing and organization as they support hierarchy and may contain subfolders. Creating an efficient folder structure may greatly simplify the navigation between attachments. For example, you can add subfolders 'Invoices' and 'Projects' to the Odoo document 'Contacts' and then easily find all person's invoices and attachments related to his/her projects.

With the help of folders, you can conveniently navigate through files, create easily-reachable structures, restrict rights for a particular folder, create personal storage, and even sync some/all of the folders to one or several cloud clients (for example, Google Drive, OneDrive). You can read more about the folder’s features in articles: Folders in Cloud Storage Solutions, Folder rules, Hierarchy of folders, Synchronization Principles, and Access Rights.

Folders are connected to the Odoo objects. You can add links between them, by creating a folder rule, which will generate folders automatically as a matching object appears (see Folder Rules). For example, select the model 'Task' to make Odoo add a folder for each project's task (Tasks > Task 1, Task 2, ...). Automatically created directories would contain all attachments their linked objects have. Folders are updated regularly based on the scheduled job (see Hierarchy Rules)

The folder rules allow creating a particular structure of folders, which is preserved while syncing with a cloud client of your choice. After creating a rule, no further actions are required, however, you can always change the rule. In this case, the folders will be recalculated.

Not only you can create a rule, which generates folders, but also you can create a folder or a subfolder manually. Manual folders and subfolders can be added from the Files Manager interface, and object's attachments box, and may even be synced from the cloud (see Files Manager Interface, Synchronization Principles). 

Manually created folders are particularly useful when you need a particular folder, which cannot be extracted from Odoo. They can serve as personal storage. Specify the users who will be able to access it, place it anywhere on the folder’s tree, and add any files to it. For example, configure the folder, so a user could access 'Office design', but not 'Office design/Commercial contracts' (see Access Rights). 

Automatic and manual folders may contain attachments. Odoo attachment is a way of organizing and storing files in Odoo. Attachments can be added through to the attachments box of a particular Odoo object, its messages thread, or to the related object’s folder in the Files Manager. As the automatic folders are generated, the related attachments are also added to them, so you can access them both from the Files Manager interface and the attachments box (see Attachments Box).

Both automatic folders and manual folders, their attachments, and manually uploaded files can be synced with cloud clients. Read more about their sync in the articles: Folder rules, Files Manager Interface, and Attachments Box.

You can assign a particular cloud client to each automatic and manual folder. For example, you have a manual folder 'Important documents', and an automatic folder related to the sale order 'S0003'. You can sync the folder 'Important documents' with OneDrive and the folder 'S0003' to Google Drive. Thus, in OneDrive you will see the structure Odoo > Sale Orders >Important Documents, and in Google Drive the structure Odoo > Sale Orders > S0003. To assign a cloud client to an automatic folder, specify the cloud client in folder rules. To assign it to a manually created folder, start editing the folder from the single-view interface.

You can sync a child folder and not sync the parent one. For example, sync the folder 'Tasks' and don’t sync its parent folder 'Project'. However, keep in mind, that a child and a parent folder cannot have different cloud clients assigned. Even if originally a folder rule had another cloud client assigned, as you choose a parent folder rule, the child's cloud client is changed to the parent’s one. For example, you have the parent folder 'Project' and the child folder 'Tasks'. You have assigned Google Drive as a cloud client for the folder rule 'Project' and OneDrive for the folder rule 'Tasks'. Both folders will be synced to Google Drive regardless of the child's settings.



Files Manager Interface


The module has a convenient menu, from where you can see and manage the folder's structure. For that, the single-view interface was introduced.

As you create some folder rules, with the next scheduled job, the related folders appear in the Files Manager interface. The order of the folders is set according to the folder rules sequence. The smaller the sequence, the higher the folder. 

You can see and manage folders in the left navigation menu. From there you will be able to: search for a particular folder; open a linked object of a folder, if any; see the configuration of a folder; create a new manual folder or subfolder, edit it, and change the order by drag&drop.

If you have a lot of folders, then there might be a necessity to use search, to easily find the one you need. For that, use the navigation input 'Search folder' on the left side of the single-view interface.

If a child folder is selected, its parents will be hierarchically highlighted by the border of dots around the name of the element. Thus, it is always clear that a child folder is chosen (even if the structure itself is closed).

As you right-click on an automatically created folder, you see the following actions:

1. Download as Archive

2. Create Subfolder

3. Open the linked object

4. Settings

As you click 'Download as Archive', the downloading of the folder's attachments starts automatically. For example, you have a folder structure Contacts > Azure Interior > Sale Order 1, with attachments in each of those folders. If you click on the folder 'Azure Interior' and chose the option 'Download as Archive', then the attachments of this particular folder will be downloaded. If you want to download the attachments from various folders, just select them and use the mass action 'Download' (read below). 

If you click 'Create a subfolder' then the child folder will appear on the folder's tree. Type the folder's name to finish creating the subfolder. You can create a subfolder to any folder. Subfolder cannot be a parent folder of an automatic folder. For example, you have a folder structure Contacts > Azure Interior > Sale Order 1. You can add a subfolder to each level of this structure: Contacts > Azure Interior, Jake Ruth > Sale Order 1, Sale Order 567 > For documents. In this example, Jake Ruth is a subfolder of the folder Contacts, Sale Order 567 is a subfolder of Azure Interior, and For documents is a subfolder of Sale Order 1.

Automatically generated folders are the folders, which are generated based on Odoo objects. Thus, it is possible to open a linked object in a folder. To open the related object, choose the option 'Open linked object'. For example, you have a folder structure Contacts > Azure Interior > Sale Order 1. If you right-click on the option 'Azure Interior' and choose 'Open linked folder', then the contact's card of Azure Interior will be opened in the pop-up window. Click Open the linked folder' by 'Sale Order 1' and the linked sale order will be opened in the pop-up window.

To see the automatic folder's settings, right-click on the folder and choose the option 'Settings'. Automatic folders rules hierarchy and settings cannot be changed from the single view menu. To change the rule's settings go to Configuration > Folder Rules.


From the single-view interface, you can also create and manage manual folders. To add a root folder manually click on the button 'Create new folder' below the folder's list and write its title.

To add a subfolder:

1. Right-click on any folder

2. Choose the option 'Create subfolder'

3. Write the title

It is possible to change the hierarchy of a manual folder by drag&drop. However, it isn't possible to assign a manual folder as a parent to the automatic one. Also, you can't drag&drop automatic folders. Their hierarchy should be changed in the related folder rules, if necessary.

As you click on a manually created folder, you see the following actions:

1. Download as Archive - allows downloading the attachments of a particular manual folder

2. Create Subfolder - allows creating a subfolder to the manually created folder. You can create as many subfolders as you need

3. Rename - allows changing the name of a particular folder

4. Edit Settings - change properties of the manual folder, including name, parent folder, assign cloud client, limit access to a user or user groups, add some notes

5. Archive - allows removing a folder from the folders tree. It is possible to restore the folder later.


In the central part of the interface, you see the attachments of the currently opened folder. Only the attachments of one level are seen. For example, if you click on the parent folder 'Azure Interior' you will see only files of this folder and not of all child folders that it includes.

You can upload the attachments from the single view interface by clicking on the button 'Upload file'. The files are uploaded to the currently selected folder.

To open an attachment's details card click on the thumbnail. There you will be able to see and manage the information about the file.

Select multiple attachments by clicking on the square in the top right corner of it. This way you can select multiple attachments. Click the 'Select this folder attachments' button to choose all attachments found by the filters. To deselect one or several attachments, click on their titles in the third functional interface or on the square in the top right corner of an attachment. To remove the selection click on the button 'Reset' in the right functional panel by the line 'Selected attachments'.

The selection will not be reset as you switch between folders and filters, use the search bar or apply mass actions. 

You can use the search bar to find a particular attachment. You can search by name, folder, author (created by), and mime type.

Just start typing the word, choose one of the options, and click 'Search'. The search takes place in the currently selected folder. But you can switch to another folder by clicking on it and previously chosen search criteria will not be removed. To reset the search click on the cross by the searching option.


As you select an attachment, the right functional panel appears. In the right functional panel, you will find the list of mass actions, which allow performing an action to all selected attachments at once. The available mass actions are:

1. Download - allows downloading all selected attachments. If there are two or more attachments to download, then they will be downloaded as .zip

2. Update - allows moving the attachment to another folder. Start typing the folder's name to find the required one quickly

3. Delete - allows removing an attachment permanently.


The list of mass actions can be edited. You can select the mass actions to show only the ones that you really need. To add a mass action:

1. Go to Configuration > Configuration

2. Find the section 'Mass actions'

3. Click 'Add a line'

4. Choose mass actions by ticking the box by the action

5. Click 'Select'

6. Optionally, change the order of mass actions by drag&drop (this order will be preserved)

7. Click 'Save'.

After saving the changes in settings, the list of mass actions in the right navigation panel will be updated.

To delete a mass action that you no longer need, click on a bin icon by the action.

On the form of each mass action, both newly added and existing ones, it is possible to choose the security groups that will be able to see and perform it. For that, just click on the mass action in the list of mass actions in configurations, then, go to the tab 'Security', click 'Add a line' and choose the group names.

Keep in mind, that some mass actions have preset security groups. So, make sure, that the users that should see those mass actions are included in those groups, or change the mass actions security settings.


In addition to the available actions, you can also prepare your own mass actions. Batch actions for attachments are based on Odoo Server Actions. It means that you may add custom mass editing operations.

To create a new mass action:

1. Go to configuration and find the section 'Mass Actions'

2. Click 'Add a line'

3. Click 'New'

4. Type the name of the action

5. Choose the model 'Attachment'

6. Choose an action to do (according to the action, the list of further configurations will change)

7. Create an action by clicking 'Add a line' in the tab 'Data to write' and choose the related details

8. Optionally, in the tab 'Security' choose the security groups that will be able to see and apply the mass action

9. Click 'Save&Close'

10. Click 'Save'.

After that, it will appear in the list of available mass actions, from where it can be added to the right navigation panel. Just choose the articles and click on the action, to update them. 




Attachments box


As you create some folder rules, after the scheduled folders refresh, the attachments boxes of the related models change. Attachments box – the standard Odoo interface, where attachments are stored. To open the attachments box, just go to any Odoo object’s form view, find the ‘Clip’ icon, and click on it. Here you would see all object’s attachments, which users can manage.

From the attachments box, you will be able to see the object's folder and its children, if any. Navigate through folders by clicking on the arrow icons to see the subfolders. Click on the folder to select it and see its attachments.

Even if you have a long list of folders, you can easily find the one you need with the help of the search bar. Just start typing the folder's title and click on the button 'Search' on the right side of the field. If there is a match, the result will be marked red. To reset the search, click on the button 'Reset' on the right side of the search bar.


As you right-click a folder, the list of actions appears. The list of actions is slightly different for manual and automatic folders.

The available actions with the automatic folders are:

1. Download as Archive - allows downloading attachments of a chosen automatic folder

2. Create Subfolder - allows creating a subfolder to an automatic folder. The subfolder is added to the folder's tree according to the hierarchy. Type the folder's name to finish creating the subfolder

3. Open in File Manage - allows opening the related folder in the File Manager for quick access to the main folder tree. Above you will see the breadcrumbs to quickly return back to the object

4. Settings - allows checking the folder settings. To change the settings of the folder you need to change the settings of the related folder rule. 

The available actions with the manual folders are:

1. Download as Archive - allows downloading the attachments of a particular manual folder

2. Create Subfolder - allows creating a subfolder to the manually created folder. You can create as many subfolders as you need

3. Open in File Manage - allows opening the related folder in the File Manager for quick access to the main folder tree. Above you will see the breadcrumbs to quickly return back to the object

4. Rename - allows changing the name of a particular folder

5. Edit Settings - change properties of the manual folder, including name, parent folder, assign cloud client, limit access to a user or user groups, add some notes

6. Archive - allows removing a folder from the folders tree. It is possible to restore the folder later.


You can add files through the attachments box, message thread, or through the Files Manager. To add a file through the attachments box, just open the related object, click '+add attachments', and select the file to upload. It is also possible to add a file to another folder from the list if an object has child folders. For that, select the folder by clicking on it, then click '+add attachments' and select the file to upload. Another way to upload files to the attachments box is by drag&drop. Just pull the file to the attachments box and drop it when you see the uploading wizard.

After uploading, you will see the standard Odoo functional buttons on the attachment cards. The buttons allow performing certain actions with the attachments. Depending on the type of file, the buttons, and their placement may be different.

For example, if you upload a picture, you will see its thumbnail. Click on the picture to see its preview. Below the preview window, you will see the buttons 'Print' and 'Download'. To delete a picture, click on the 'Cross' icon in the top right corner of the thumbnail.

As for other extensions: some attachments have the preview, for example, pdf, and some don't, for example, doc. So, if you upload a document, then the preview will not be available. On the document's card you will find two buttons:

1. Delete - allows deleting the document

2. Download - allows downloading the document.

When a file is added to the message thread of an object, it also gets to the attachments box. The files in the message thread have the same functional buttons. You can also open, download, and delete them, without opening the attachments box.

To add a file through the Files Manager, open the Cloud Storage menu, select the folder by clicking on it, click the button 'Upload file', and choose the file. After that, you will be able to access the file from both the attachments box of the object and Files Manager, as they are interconnected.

Even if the Files Manager is hidden from the user, if he/she has access to an object, he/she will be able to access the related folder from the attachments box. The other folders from the structure will be seen only in case the user has access to them as well (see Access Rights). For example, we have a sales manager Anita Oliver, that doesn't have access to the Files Manager. As she opens a sales order 'S0010', in the attachments box, she sees the folder 'S0010', and the manual folders 'Related Documents' and 'Terms of Agreement' with related attachments. But, she doesn't see the related folder 'Projects', as she doesn't have the project manager's rights.

Synced files and folders will also be accessible from the attachments box. The automatic folders will be marked by the related cloud client icon. The manually created folders will have a ribbon on the folder's icon (see. Synchronization Principles). 

Synced files would have app-related thumbnails instead of standard small previews to avoid excess requests to the cloud client for each form opening. For example, you will not be able to see the picture's preview without clicking on the attachment.

From the attachments box, you can also open the Cloud Folder to see all the synced files and folders related to the object. For that, the cloud icon 'Open in Cloud' is introduced. Click on it and in a new tab you will be redirected to the related folder.

Even after the sync, a user might download attachments locally by clicking on the 'Download' icon on the file. The downloading of the synced files from Odoo doesn't require login into the cloud client.

Odoo standard preview would equally work for standard Odoo attachments and synced attachments. Files, which do not have the preview function in Odoo (for example, .doc), will be opened in the cloud client.

If you click on the remove button, then after submitting your decision in a pop-up window, the link will be removed from the Odoo. And after the next sync, the file will be removed from the Cloud Storage as well (see Synchronization Principles).




Automatic Folders


Folder rules – are the configurations, based on which the module generates folders by checking the settings and fields of models and objects. The folder rules allow creating a particular structure of folders, which is preserved while syncing with a cloud client of your choice.

Folder rules serve for creating folders for Odoo objects, creating a flexible folder structure, and preparing folders and attachments, if any, for synchronization.

To configure a particular Odoo document type and generate a folder, you should just prepare a new folder rule (Cloud Storage > Configuration > Folder rules). For example, create a folder rule 'Project', by clicking on the button 'New' in the folder rules' menu and choosing 'Project' in the field 'Model to sync'. Automatically created directories would contain all attachments their linked objects have.

As you open the folder rule's menu, you see a list of folder rules. From the columns on the right side, you can find out the information about them, without opening them. Here you see:

1. Folder name

2. Cloud client, if any

3. Rule type (if the add-on Cloud Sync for Enterprise Documents is installed) (see Workspace-Related Rules).

4. Parent rule, if any


You can change the order of the folders by changing the order of folder rules. Open the folder rules' menu and drag&drop to change the rules sequence. The lower the sequence, the higher the related document's folder will be. Keep in mind, that the child folder rules, will not be higher than their parents regardless of their sequence. For example, the folder rule 'Customers' is a parent one for the rule 'Invoices'. Thus, even if we drag&drop the rule 'Invoices' above the rule 'Customer', it will not be shown higher in the folder's tree.

From the folder rules menu, you can also archive folder rules. For that open any rule and click on the 'Gear' icon or select several folder rules by ticking the box on the left side of rules and selecting the action by clicking on the 'Gear' icon. If you archive the folder rule, with the next scheduled job the related folders will also be archived.


Folders are updated regularly. As you create an automatic rule, it appears in the Files Manager only after the scheduled job 'Prepare Cloud Folders'. The folder rules are checked and updated every 15 minutes. If there is really a big number of objects, some folders might be created/refreshed with one of the next scheduled jobs.

It is possible to trigger the scheduled job manually, by going to the Cloud Storage > Configuration and by clicking on the button 'Launch Folder Update' at the bottom of the page. However, we highly recommend using the button only for testing purposes (see Extra Notes).

To configure automatic folder rules a user should belong to the security group 'Cloud Storage > Administration' (see Access Rights).

If you have the add-on Cloud Sync for Enterprise Documents, then as you create an automatic folder rule, one more field 'Rule Type' appears. The available options are 'Model Related Rule' and a 'Workspace Related Rule'. The first one relates to Odoo models (for example, Sale Order, Purchase Order, Lead/Opportunity, Project, Task) (see Model-Related Rules). The second one relates to the module Documents (see Workspace-Related Rules).


A model is an Odoo document type (for example, Sale Orders or Contacts). By choosing the model we tell the module, where to get the information to generate folders.

Model-Related Rule - a folder rule, which is based on an Odoo model. By creating a model-related rule, we define the criteria based on which the folders are created.

To set a model-related automatic folder rule:

1. Go to Cloud Storage > Configuration > Folder Rules

2. Click 'New' 

3. Choose the rule type as 'Model-Related Rule' (If you have the add-on Cloud Sync for Enterprise Documents, otherwise it is applied by default as the only available one) 

4. Choose the folder name. Avoid using the following symbols in folders' and files' names "*, ?, ", ', :, <, >, /, +, %, !, @, \, /," as upon saving the name they will be replaced with '-'. It is done to avoid conflicts with file systems. The name should include less than 100 symbols  

5. If there is at least one cloud client connected, then you may assign it to sync the folders with attachments or leave the field empty if you don't want to sync them (see Synchronization Principles)

6. Choose the related model to sync and optionally set a 'Parent rule' (see Hierarchy Rules)

7. Optionally, limit the folders, which should be synced by applying filters and/or periods (see Filters & Periods)

8. Optionally, introduce expression to extract folder names for directories (see Name Expressions)

9. Optionally, create default folders structure, which will be added inside the objects-related folders with the first sync (see Default Folders)


The app lets split models into a few folders based on selected filters. Use any document storable field to distinguish a directory. Have a separate folder for individuals and companies, for European and American opportunities, for quotations and confirmed orders, for each project, etc. You can also limit documents by relative periods by using the date fields of linked documents. For example, leads registered in the last 3 months or invoices updated the last week (see Filters & Periods).

Define name expressions to specify titles of documents' cloud client folders. For instance, to include a project name in a task directory (see Name Expressions).

Prepare a hierarchy of default folders and files to be created when a document directory is synced to a cloud client for the first time (see Default Folders).

The folder rules are applied according to the scheduled job 'Prepare Cloud Folders'. They are checked and updated every 15 minutes. (see Folder Rules)

If you change the rule, then with the next cron job, the changes will be applied. The list of folders will change according to the new rule's settings. 

Hierarchy of Rules

When you need to add objects of one model inside the objects of another one, you can specify the parent rule. For that, choose the model in the field 'Parent Rule' and choose a related many2one field. This way, you will be able to reflect your Odoo workflow logic, create a complex folders structure and navigate through folders conveniently. So, it will be easier to find the required attachments. For example, place tasks inside of the related Project and Project inside of the related contacts to get the structure Contacts > Azure > Projects > Software Design > Tasks > Prepare markup.

The models can be linked by the many2one field. For example, if you want to store task folders inside of the related project's folders, then, on the card of the task, there should be a many2one field, which contains the information about the related project.


Let's create and assign a parent rule to the rule 'Tasks':

1. First, create a model-related folder rule, choose 'Projects' as the 'Model to Sync'.

2. Start creating another model-related folder rule, choose 'Tasks' as the 'Model to Sync', choose the previously created folder rule 'Project' as a parent rule and as the 'Parent Model Field' choose 'Project'.

As you create some folder rules, with the next scheduled job the structure will be reflected in the Files Manager's Interface. For example, in the case above, the following structure will be generated: Project > Project XYZ...> Tasks > Task 1...


You can make an even more complex structure by creating subfolders manually or by adding default folders. For example, you have created folder rules 'Project' and 'Tasks'. Then to the parent folder 'Project' you can add the manual subfolder 'Project managers' to keep the information or the file related to the responsible for Project people. To the folder rule 'Task' you can add a default folder 'Documents to sign' with the file 'Terms of agreement'. The folder will be created in all task folders, so you will be able to share it with the client if necessary (see Default Folders).

The folders' structure is also preserved in the attachments boxes of the objects (see Attachments Box). Here you can see the hierarchy of folders related to the object, switch between them, and add folders manually. Also, you will be able to see, upload and manage attachments.

It isn't necessary to sync the whole structure of folders to a cloud client. You can assign the client to some of the folders. Keep in mind, that the child folder cannot be synced to a different cloud client. Even if it has another one in its settings, it will be synced to the parent folder's client.

Filters & Periods

Create folders for only particular objects of a specific model, and don't create others, for easy access. For example, to have only won opportunities folder, to divide sale orders by the salesperson or particular period of time. Therefore, the app lets limit objects for which folders are created.

The list of the model's objects to sync can be limited by:

1. Filters

2. Periods

With the help of filters, you can use any document storable field to distinguish a directory. Have a separate folder for individuals and companies, for European and American opportunities, for quotations and confirmed orders, for each project, etc.

To add a filter:

1. Create a new folder rule or start editing an existing one

2. Click on the button '+Add a filter'

3. Set up the rule, for example, 'country contains US'

4. If there are any records, that match the filter you will see their number on the right side (click on it to see the records to make sure the filter is correctly set)

5. Optionally click on the '+' button by the filter to add one more rule, so only records, that match 'ALL' or 'ANY' of the rules will be considered for sync


Here are some useful filters examples by models:

Project

Generate folders for internal projects. For that add a tag 'Internal' to such projects and set up a filter Tags > Name = Internal in the related folder rule.


Contact

Generate folders for contacts of a particular country. For that add a filter Country = US.


Lead / Opportunity

Generate folders for won opportunities. For that add a filter Is Won = Won.


Sales Order

Generate folders for quotations. For that add the filters: Status = Quotation, Status = Quotation Sent. Switch the filtering button to 'ANY'. So, if a record matches any of the filters it will be considered by the rule.


Purchase Orders

Generate folders for purchase orders with a particular status. For that add a filter Status = RFQ.


Appointments (for the module Universal Appointments)

Generate folders for appointments of a particular responsible person. For that add a filter Responsible = Anita Oliver.


Articles (for the module KnowSystem)

Generate folders for articles with attachments. For that add a filter Attachment is set.


You can create as many auto folder rules that refer to the same model as you want. But, try to make filters self-exclusive, so a document could be definitely assigned. For instance, 'customer but not supplier', 'supplier but not customer'. Otherwise, a specific document folder will be added to the folder rule, which sequence is smaller (such folder rules are higher in the list 'Auto Folders Rules'). For example, you have 2 Folder Rules: 'Sale Orders' and 'Cancelled Sale Orders'. The order S00001 was cancelled and therefore it matches the conditions of both of them. However, the folder rule 'Cancelled Sale Orders' has a smaller sequence, as it was placed above the 'Sale Orders'. Thus, the object S00001 will be added to the model 'Cancelled Sale Orders'.

It is also possible, to limit the document folders list by relative periods through using date fields of linked documents. For example, generate folders for only leads registered in the last 3 months or invoices updated the last week.

Periods are especially useful when we want to create a special folder for old objects, or sync only the objects for a particular period. For example, you can create such folders as 'this year invoices', 'last year invoices', 'archived invoices'. When a folder no longer matches any filters or periods, it will be removed from the Files Manager with the next folders refreshing. If the folder was synced, then the files will be returned to Odoo with the help of the reverse sync.

To set the time period of a folder rule:

1. Click on one of the folder rules or start creating a new one

2. Choose the tab 'Periods'

3. Click 'Add a line'

4. Choose the object's field, which will be considered to choose the objects-related folders for sync

5. Chose to consider the next or the last period

6. Set interval and interval type

7. Tick the box 'Including current', to include the current period in the calculations (For example, today is 25/09/2020. For example, in case 'last 2 months' is selected. If the box is not checked, Odoo would consider July and August. If checked, August and September.)

8. In the field 'Compared to', choose the option 'Today', if the set period should be calculated relatively to today. Choose the option 'Past'/'Future' and set the period type and length in the fields 'Interval type' and 'Interval' to calculate the period relatively to the certain moment in the past/future.

9. You can check the set periods below in the section 'If today, the periods would be...'

10. Optionally add some more periods


Periods can be calculated: relatively to today (Current day), relatively to the past period (Current day – Compared period), and relatively to the future period (Current day + Compared Period).

To calculate the periods relatively to today, as you set a period for a folder rule, choose the option 'Today'. For example, today is 03/09/2023, which means that the 'last 2 months' are July and August. The 'next 5 days' are 04/09-08/09/2023. If the 'Including current' flag is checked, the current period is also included. For example, today is 03/09/2023, which means that the 'last 2 months' including current are August and September. The 'next 5 days' including current are 03/09 – 07/09/2023.

To calculate the periods relatively to the period in the past, as you set a period for a folder rule, choose the option 'Past'. This way, we compare the set period not with the current day, but the Current day – (minus) the Compared period. It may be particularly useful, when you want to keep old records in the cloud, while having the most topical ones handy in Odoo. For example, you can set the period 'Created on in the last 5 years compared to past 2 years'. For example, if now it is September of 2023 and the option including current is ticked, then the objects created during the following period will be considered for the sync 01/01/2017 – 32/12/2021. If it isn't ticked, then 01/01/2016 – 32/12/2020. This way, when the year 2024 starts, the considered period will be changed to 01/01/2018 – 32/12/2022 or 01/01/2017 – 32/12/2021 respectively.

When the option 'Future' is selected, then we compare the selected period to a date in the future. This way, we compare the set period not with the current day, but the Current day + the Compared period. For example, you can set the period 'Expected Closing in the next 3 weeks compared to future 2 weeks' to the folder rule 'Opportunities'. Then, if the option including current is ticked, and today is the 15th of September 2023, then the objects with the expected closing in the following period will be considered for the sync 2023/09/18 – 2023/10/08. If it isn't ticked, then 2023/09/25 – 2023/10/15.

As you set periods, the folders for the objects that match the periods are generated. If there is a cloud client assigned to the folder rule, then the folders with the attachments will be synced. After some time, as the periods are calculated relatively to the moment in the past, present, or future, certain objects may no longer match the period. Such objects are returned to the instance with the help of the reversed sync. For example, we set the period for the folder rule 'Sales Orders' as Created on in the last 2 months including current. Now, it is 15th September 2023, so the sale orders that were created in August and September are synced. When we create a new sale order it also gets synced, while its' creation date is in September. Then, October starts and the sale orders that were created in August no longer match the set period and therefore the related folders with files are returned back to Odoo.

Restrictions of periods are accumulated. If you added a few lines, it means that all period conditions should be satisfied. For example, the deadline should be within the last 2 months AND the ending date should be within the last year. However, if you added the same date field twice, the condition should satisfy ANY of those criteria. For example, the deadline should be within the last 2 months OR the next month AND the ending date should be within the last year.

To make sure that the periods are correctly configured, please, consult the dynamic field 'If today, the periods would be...'.

Here are the results of the filters and periods' influence on folder rules:

1. If, after adding some filters or periods, an object-related folder no longer relates to a folder rule, then its folder will be archived. For example, you have a folder rule 'Contact' with the filter 'Country =US' and the 40 records match this condition. Then you were asked to change the country of one of the sale orders to Belgium as there was a need to send the order directly to the partner's customer. In this case, this sale order will no longer relate to the synced ones as it doesn't match the filter. If the related to the order folder was already synced to the cloud client, it will be archived. And, the files will be returned to Odoo from the cloud client with the help of reverse sync.

2. If an object didn't relate to a folder rule but later matched the conditions of one, then its folder will be created in the related directory. For example, we had a sale order with the country 'Belgium' and later we changed it to 'US'. Thus, as it now matches the filter, the related to the record folder will be generated in the Files Manager.

3. If you have two folder rules, that relate to the same document (for example Sale Order), then the object-related folder, that relates to both of them, will be added to the folder rule with the smaller sequence. For example, we have folder rules 'Sale Orders' and 'Cancelled Sale Orders'. The order S00001 was cancelled and therefore it matches the conditions of both of them. However, the folder rule 'Cancelled Sale Orders' has a smaller sequence, as it was placed above the 'Sale Orders'. Thus, the object S00001 will relate to the folder rule 'Cancelled Sale Orders'.

4. If an object matched the conditions of one folder rule and then matched the conditions of another one instead, then in this case the folder with files will be transferred to the right directory with the next scheduled job. For example, we have folder rules 'Sale Orders' and 'Cancelled Sale Orders'. The folder rule 'Sale Orders' now has a complex filter 'Status = Quotation; Status =Quotation Sent; Status = Sales Order; Status =Locked', so all sales orders, which aren't cancelled relate to it. One of the sale orders (S0003) was later cancelled. Thus, it matched the conditions of the folder rule 'Cancelled Sale Orders' and was transferred to the related directory.

Using Filters and Periods will help to minimize the consumption of the resources spent on refreshing folders and on the sync (if you sync folders) and will let you concentrate only on the relevant objects.

Name Expressions

When the folders are created, by default, their title is generated by the name get method. For example, the contact Anita Olivier will have the folder 'Azure Interior/Anita Olivier' added. For different models, this method may work differently. For Contacts with a company assigned, the company's name is added before the person's name. For example, the contact Addison Olson will have the folder Deco Addict, Addison Olson added, where 'Deco Addict' is the company she is working for. But you can always change the way the names are generated.


If you want to have another logic for generating names for folders, then you can also use the value of object fields to generate them with the help of name expressions. This way you will be able to get the necessary information about an object, without opening it. For example, if you create a folder rule 'Contact', their phone numbers can be added to the folders' titles.

It is possible, to define the rules for folder names, so they would include the information of one or several fields. To that end, apply the special syntax (the same, that is used in Odoo email templates.)

To add an object's name :

1. Start creating a Folders rule or start editing an existing one

2. Open the tab Name Expression

3. Type the name using the syntax in the field 'Name Expression'


An expression, created with the help of the syntax starts and finishes with the double curly brackets {{}}. Everything, that is not included in brackets, will be written in the folder's name. For example, let's add a name expression to Contacts. Add the expression "Files of {{object.name}}, partner" in the field 'Name Expression'. After refreshing, the contact's folders will look the following way: Files of Abigail Peterson, partner; Files of Anita Oliver, partner. The comma was also outside the brackets, so it will be also applied right after the parsed expression.

You can add a condition, so if the object has a particular field filled, then the name will be taken from the particular field. The conditions are introduced by the operator 'and'. The field following the last 'and' will be used as a name if all the previous conditions were true. The action, which should be done otherwise, is introduced by the operator 'or'. For example, let's add the name expression "{{object.mobile and object.mobile or 'no mobile phone'}}" to Contacts. In this example, if a contact has a mobile phone, then the field mobile phone should be used for the folder's name. Otherwise, the information in the quotation marks will be used, in this case - no phone. After refreshing, the contact's folders will look the following way: -43454123453; no phone.

Try to avoid the following symbols in folders' and files' names: *, ?, ", ', :, <, >, /, +, %, !, @, \, /,. The folders refreshing will replace such symbols with '-'. It is done to avoid conflicts with file systems.

You can also create a complex expression, which contains information from several fields. In this case, each field should be written in separate curly brackets. Let's add a complex expression "{{object.name}} {{object.phone and object.phone or 'no phone'}}, {{object.mobile and object.mobile or 'no mobile'}}" to Contacts. In this complex expression, the first represents an object's name, and the second and the third are conditions, which check whether the fields phone and mobile are filled. After the folders' refreshing, the contact's folders will look the following way: Abigail Peterson 356745, no mobile; Anita Oliver no phone, -37854756231. Pay attention, that there isn't a comma, after the name expression, so it wasn't added to the result.

In case an expression is parsed successfully, the title of each object-related folder changes according to it.

In case the expression cannot be parsed because of the syntax error, the standard name_get method will be used.

When a part of the title can be parsed, and the second one contains a condition, you should also add the operator 'or' to the condition to introduce what to write in the title, if the condition is false. Otherwise, when the condition is not met, you will see 'False' as part of a folder's title.

You can change the syntax anytime or even return to the default name_get method.

If after rendering, the folder name appears to be empty, the app would use the standard name_get method to avoid folders without names.

Here are some useful examples of the names, created with the help of the syntax used in Odoo email templates:

Contacts


Name expression: {{object.name}} {{object.phone and object.phone or 'no phone'}}, {{object.email and object.email or 'no email'}}

Result examples: Anita Oliver, 34854325, anitao@test.com

Use this expression to include contact's phone number and email in the folder's title.

Sale Order


Name expression: {{object.name}}, {{object.state}}

Result examples: S03093, draft; S03094, sale

Use this expression to see the state of a sale order in the folder's title.

Purchase Order


Name expression: {{object.name}}, Total {{object.amount_total}}

Result examples: P00001, Total 28700.0

Use this expression to see the total for a purchase order in the folder's title.

Lead / Opportunity


Name expression: ${object.name}}, ${object.automated_probability}}

Result examples: Table with chairs, 50.0

Use this expression to see the automated probability of an opportunity in the cloud client. The probability will change after sync as the opportunity will move in the pipeline.


Name expression: {{object.name}}, {{object.invoice_date}}

Result examples: BILL-2018-09-0001, 2021-07-12

Use this expression to see the invoice date in the folder's title.

Count attachments


Name expression: {{object.name}}, {{object.message_attachment_count}}

Result examples: Abigail Peterson, 12

Use this expression to see how many attachments are in each object's folder, without opening it. Can be used for any Folder rule.

Default folders

Default folders - manual folders with or without default attachments that would be auto-generated for a specific Odoo object folder, as soon as an object-related folder is created for the first time. Further folder refreshing will not result in generating default folders with default attachments.

This function allows creating the same structure of folders in each object-related folder of the folder rule. For example, the folder rule, based on the model 'Sale Order' was set. The default folder structure 'Documents to sign> Terms of agreement' was added. So in the end, the structure will be 'Odoo > Sale Order > S00001, S0002... > Documents to sign> Terms of agreement'.

You can also add some files to any of the default folders, and with the first folders refreshing, the folders with files will be added to all related objects. For example, you can create a default folder for employees with the documents for signing. Thus, as a new employee's card is created in Odoo, with the next folders refreshing, the default folder with the files will be added to the related object's folder.

How to configure default folder and attachment generating:

1. Start creating a folder rule and choose a model, or start editing an existing one, if it wasn't refreshed yet

2. Open the tab Default Folders

3. Click 'Create Root Subfolder'

4. Type a name of a folder

5. Optionally add some more folders

6. Optionally add some files by clicking on the button 'Upload Root File'

7. Move folders by drag&drop to change the hierarchy

8. Click on the folder with the right side of the mouse: to create a folder inside the folder, to rename, edit or delete it


The add-on Cloud Sync for Enterprise Documents () introduces the possibility to generate folders for workspaces.

Workspace-Related Rule - a folder rule, which is used to sync the files from the module Documents, which creates folders according to the workspace structure.

To force Odoo to prepare workspace-related directories, define folder rule(s) of the type 'Workspace-Related rule'. The tool would automatically create linked folders and sync those for chosen cloud storage with one of the next scheduled jobs.

The folder rules of the workspace type are marked in the folder rule's menu with a blue colour.


To set a workspace-related automatic folder rule:

1. Go to Cloud Storage > Configuration > Folder Rules

2. Click 'New'

3. Choose the rule type as 'Workspace-Related Rule'

4. Choose the folder name. Avoid using the following symbols in folders' and files' names "*, ?, ", ', :, <, >, /, +, %, !, @, \, /," as upon saving the name they will be replaced with '-'. It is done to avoid conflicts with file systems. The name should include less than 100 symbols

5. If there is more than one cloud client connected, then choose the one to which you want to sync the files or leave the field empty if you don't want to sync the folder (see Synchronization Principles)

7. Optionally, limit the objects, which should be synced by applying filters (see Filters & Periods).

It is not obligatory to reflect the whole DMS structure. Thus, it is possible to filter workspaces by any storable field. For example, add a folder only for workspaces that contain the keyword 'Internal'. The process of adding a filter to a Workspace-Related Rule is the same as to a Model-Related Rule (see Filters &Periods).

For example, let's create a Workspace-Related Rule to sync only one's own documents. For that, start creating a folder rule, choose the rule type as Workspace-Related Rule, type the folder's name 'Documents', and choose a cloud client, for instance, Google Drive. Then, click 'Add Filter' and choose Own Documents Only is set (true).

If a parent folder matches a filter, then all its children will also be added.


Certain actions with workspaces and documents may have a different result depending on the place, where the changes are introduced (in Odoo or in a Client). Let's look at the most popular ones.

The actions with workspaces in Odoo:

1. Adding a new workspace with the cloud client assigned.

If you add a new workspace and assign a cloud client to it, then a related folder will be created in the cloud client with the next sync.

2. Renaming a workspace

If you rename a synced workspace, then the related folder in the cloud client will be also renamed with the next sync.

3. Moving a workspace

If you move a synced workspace, for example, by changing the parent one, then the structure in the cloud client also changes accordingly with the next sync.

4. Deleting a workspace

If you delete a synced workspace in Odoo, then, with the next sync, it will be deleted from the cloud as well.

The actions with workspace-related folders in cloud client:

1. Adding a new folder

If you create a folder in the cloud client, then it is also added to Odoo as both: a workspace folder and a folder in Files Manager. The files added to a workspace folder in the cloud client will be also added in Odoo. You can read more about the consequences of possible actions with folders and files in the article Synchronization Principles (see Synchronization Principles).

2. Renaming a folder

If you try to rename an object-related folder in the cloud client, then the name will differ in Odoo and the Cloud, until you rename the object in Odoo.

3. Moving a folder

If you move an object-related folder in the cloud client, then the structure will differ between Odoo and the Documents module. The folder will not be returned back to its previous place in the cloud, but it still will be synced.

4. Deleting a folder

If you delete an object-related folder related from the cloud client, then, with the next sync, it will be recovered without files. The broken links will remain in Odoo.

The actions with documents in Odoo:

1. Uploading a document

If you upload a document to one of the synced objects' attachments box or folders, then with the next sync, it will also be added to the related folder in the cloud.

2. Renaming a document

If you change the name of a synced document in Odoo, its name in the cloud client will also change with the next sync.

3. Moving a document

If you move a document to another workspace in Odoo, with the next sync, it will be moved in the cloud accordingly.

4. Deleting a document

If you delete a previously synced document from Odoo, then, with the next sync, it will be deleted from the cloud as well.

The actions with documents in Cloud:

1. Uploading a document

If you upload a document to one of the synced folders in the cloud client, then, with the next sync, the document will be uploaded to the related folder in Odoo as well.

2. Renaming a document

If you rename one of the synced documents in the cloud, then, with the next sync, it will be renamed in Odoo as well.

3. Moving a document

If you move a synced document to another workspace in the cloud, then, with the next sync, it will be moved in Odoo accordingly.

4. Deleting a document

If you delete a synced document from the cloud client, then, with the next sync, it will be deleted from Odoo as well.



Examples of Complex Structures


Here you will find some possible structures that you can create in your Odoo instance:

In order to achieve the structure, firstly, you need to create a folder rule 'Contacts' and choose 'Contacts' as a 'Model to sync'.


After that you need to create a folder rule 'Projects' and choose 'Project' in the field 'Model to sync'. Then, choose the previously created parent rule 'Contacts' and as parent model field choose 'Customer'.


Finally, create a folder rule 'Tasks', as a parent rule choose 'Projects' and as a parent model field choose 'Project'.


In order to achieve the structure, firstly, you need to create a folder rule 'Vendors' and choose 'Contacts' as a 'Model to sync'. Then, you need to add a filter, so only contacts with products, would be considered as Vendors: Products is set.


After that you need to create a folder rule 'Purchase Order' and choose 'Purchase Order' in the field 'Model to sync'. Then, choose the previously created parent rule 'Vendors' and as parent model field choose 'Vendor'.


 

In order to achieve the structure, firstly, you need to create a folder rule 'Vendors' and choose 'Contacts' as a 'Model to sync'. Then, you need to add a filter, so only contacts with products, would be considered as Vendors: Products is set.


After that you need to create a folder rule 'Products' and choose 'Product' in the field 'Model to sync'. Then, choose the previously created parent rule 'Vendors'. Here we also need a parent model field of many2one type, but there isn't such a field on the products template. So, we used the module Custom Fields for products and createda field 'Manufacturer'. In this case, we can add as parent model field 'Manufacturer'.


In order to achieve the structure, firstly, you need to create a folder rule 'Departments' and choose 'Department' as a 'Model to sync'.


After that you need to create a folder rule 'Employees' and choose 'Employee' in the field 'Model to sync'. Then, choose the previously created parent rule 'Departments' and as parent model field choose 'Department'.


In order to achieve the structure, firstly, you need to create a folder rule 'Sales Team' and choose 'Sales Team' as a 'Model to sync'.


After that you need to create a folder rule 'Leads' and choose 'Lead/Opportunity' in the field 'Model to sync'. Then, choose the previously created parent rule 'Sales Team' and as parent model field choose 'Sales Team'.


Contacts > Sale Orders > Appointments (for the module Universal Appointments)

In order to achieve the structure, firstly, you need to create a folder rule 'Contacts' and choose 'Contacts' as a 'Model to sync'.


After that you need to create a folder rule 'Sale Orders' and choose 'Sale Order' in the field 'Model to sync'. Then, choose the previously created parent rule 'Contacts' and as parent model field choose 'Customer'.


Finally, create a folder rule for Universal Appointments. Choose 'Appointments' in the field 'Model to sync'. Then, as a parent rule choose 'Sale Orders' and as parent model field choose 'Sale Order'.




Synchronization Principles


Synchronization is a fully automatic process and after the setup, no manual actions are required. Just create some folder rules and configure a cloud client. Synchronization is a schedule-based process, so a particular time is required for the changes to be applied

The connector works on a queue (first in - first out) principle. At first, the application scans all folders. Based on these changes, the application creates a task queue. Then the tasks are processed. Each sync, especially the very first one, might take quite long.

The synchronization doesn't take place in real-time to avoid performance conflicts and functionality issues.

Synchronization is bilateral, which means that it is done in both ways: from Odoo to the cloud client and backward. Both types of sync work in one single process. Each sync serves a particular purpose.

If the Odoo was unable to finish a task (for example, to send a file or folder), then, after some time (which is increased exponentially when the error repeats) it will return to it. The module will make up to 8 attempts (The first attempt will be in 30, the second one in 60…). If even after this time the task will be completed with an error, then it will not be performed anymore, to avoid the high consumption of the platform resources.

If there are some active tasks, then the application first does them, and only after that, and scans the folders. The application searches for the oldest folder if any.

The module tends to work on the FIFO principle, which means the module tries to first reflect the oldest changes. At first, the folders that didn't sync for the longest time are checked, and then the ones, that were synced recently. Some prioritized operations may change the order of tasks.

The queue, task creation, and control of operations fulfillment can be tracked in real-time through the module's sync logs.

Synchronization is bilateral, which means that it is done in both ways: from Odoo to the cloud client and backward. For example, if you add an attachment to the attachments box of a synced sale order S00345, then during the next synchronizations it will be sent. If you add an attachment to a cloud client folder, then with one of the next jobs it will be added to the related folder in the Files Manager in Odoo.

Direct synchronization:

1. Creates a Files Manager's folder structure in the cloud client

2. Uploads all the attachments of created folders from Odoo to the object-related folders within the special root folder 'Odoo'

3. Makes all synced Odoo attachments change their type to a link (URL), while binary content is removed with the next Odoo cleaner. So, no actual files would be stored on your Odoo server

Binary content is kept in clouds, while Odoo provides direct access to synced items.

4. Checks whether a new folder for sync is added/renamed/archived. If so, the changes will be reflected in the Cloud

5. Checks whether attachments are added or deleted for synced folders. If so, they would be created or removed from the cloud client.

Backward sync:

1. Checks whether any items are added to a cloud client document folder. If so, the app would create URL attachments for those items in the Files Manager folder and, if any, the related object's attachments box

2. Checks whether any item is renamed in the cloud client. If so, a chained Odoo attachment should be also renamed

3. Checks whether any items are deleted/moved in a cloud document folder. If so, a linked Odoo attachment would be also unlinked or moved.

Another type of synchronization - Reverse sync, was introduced to make it possible to change a cloud client or switch between them, or to reset the sync. It helps to:

1. Return previously synced files back to Odoo and delete them from the Cloud

2. Move files from one cloud client to another

The types of files for direct sync can be limited. For example, don't sync .png pictures or .pdf files. For that, go to Cloud Storage >Configuration >Configuration. Find the field 'Non synced mimetypes' and enter comma-separated mimetypes without spaces that should not be synced. For example, "application/pdf,image/png”.

If you choose not to sync a particular type of file and then add it to the cloud client, with the next sync the file will be also added to Odoo. As the limitation doesn't affect backward sync.


Take into account that the following mimetypes would not be synced disregarding this setting: "text/html", "text/css", "text/javascript", "application/javascript", "text/xml", "application/xml", “odoo.spreadsheet”. Moreover, attachments of zero size and attachments which start with '/' also would not be taken into account.

Make sure, that you use the right name for the extension. Odoo recognizes applications in its own way (with an intuitive extension). For example, 'pdf' is recognized as 'application/pdf', and the extension .mepx is recognized as application/zip. To check the extension of uploaded attachments:

1. Turn on the developer mode

2. Open the technical menu 'Attachments'

3. Click on any attachment

4. Check the extension of the file in the line 'Mime type'.


The tool relies upon a single-user endpoint. It means that all sync processes are done under a single cloud admin (app). Access rights for created folders/files are not automatized. You should administrate those rights in your cloud client.

The module doesn't provide the functionality to manage access rights to the synced files. You should administrate those rights in your cloud client. 

Synchronization of Enterprise Documents has its own specific. Therefore, the special add-on 'Solutions for Enterprise Documents' is required. In order to sync files from Enterprise Documents, as you create a folder's rule, in the field 'Rule related type', you should choose the option 'Workspace related rule' and finish the setup as usual (see Workspace-Related Rules).

Folders Sync

As soon as folders appear, the same ones are created in the cloud client with one of the next syncs. All folders are created inside the root folder 'Odoo'. The folder rule's folders serve as storage for object-related folders. Each Odoo folder will have its own cloud folder. For example, Odoo > Customers > Azure Interior > files and folders related to the object.

Changes applied to a folder in Odoo are prioritized over the changes applied to a folder in the cloud client. 

The result of your actions will be different, depending on the place, where the changes are introduced (in Odoo or in a Client).

Let's look at the actions applied by Odoo and their consequences:

1. Create a folder to sync

If a cloud client was assigned to a folder through the folder's settings or a folder rule, then such a folder will be synced. For example, we have created a folder rule 'Contacts' and the related folders were generated in the Files Manager, as we have assigned the cloud client 'Google Drive' to the folder rule, those folders were synced to the cloud.


2. Move a folder/change the parent folder

if you move a folder, for example by changing its folder rule's parent folder, then, it will be moved in the cloud client as well. For example, we have a folder rule 'Quotations' with a parent rule 'Customers'. If we clear the field 'Parent rule', the folder rule will no longer be a child one to 'Customers', thus the hierarchy will change and the folder 'Quotations' will change its place in both Files Manager and cloud client.


3. Change cloud client

If a folder's cloud client was changed through the folder's settings or a folder rule, then with one of the next sync, the files will be returned to Odoo (reverse sync) and then moved to the other cloud client (direct sync). For example, we have 2 cloud clients in our system: Google Drive and Nextcloud. The folder rule 'CRM' first was synced to Google Drive, but then we changed the cloud client to Nextcloud, so it was returned to Odoo and then sent to Nextcloud with the help of the reverse sync.


4. Change folder name

You can rename a folder in Odoo by editing it, by changing the linked-to-the-synced-folder object, or by introducing name expressions, the changes will be applied in the cloud client as well. For example, we have a client Azure Interior, which after rebranding changed its name to 'Azure' and we have changed it on the contact card as well. With the next sync, the name has changed in the cloud client.


5. A folder is no more synced

If you deassign a cloud client from a folder/folder rule or change filters of a folder rule, then the folder will no longer be synced. In this case, the folder with files will be returned back to Odoo with the help of the reverse sync with the next scheduled job. For example, we have a folder rule to sync quotations (filter: Status = Quotation Sent) and 787 quotations match the filter and are synced, then we changed the filter to Status = Quotation, and only 9 quotations matched. So, the 787 quotations (folders and files) with the status 'Quotation Sent' will be returned back to Odoo and 3 quotations with the status 'Quotation' will be sent to the cloud client.


6. Archive a folder

You can archive a folder in Odoo. The reverse sync will take place, which will return files back to Odoo. There may be various reasons that lead to archiving a folder. The folder is archived if you:

a. Delete an object

b. Archive a manual folder/folder rule

c. Change filters (so the object no more matches them)

If you delete an object in Odoo, it will also be removed from the cloud client. For example, the company of our client 'Deco Addict' was closed, so we have archived the contacts card. The files returned back to Odoo, the folder was removed from the cloud client with the next reverse sync. 

Please avoid triggering the reverse sync as it assumes the most complex operations. Make sure you really need it.


Let's look at the actions applied from a Cloud:

1. Create a folder

If you create a folder in the cloud client, then with the next sync it will be added as a subfolder in Odoo. For example, let's add a folder 'Terms of agreement' to the project's 'Renovation' folder in the cloud client. With the next sync, it is added to the related place in Odoo.


2. Change folder name

If you try to change a folder's name in the cloud client, then the changes will not be applied in Odoo. However, the name in the cloud will not be changed back either. Thus, the same folder will have different names in Odoo and Cloud. For example, we have changed the folder's name 'S0001' to 'Tables' and, after the sync no changes were applied in Odoo and, it wasn't changed back in the Cloud.


3. Move a folder

Performing such an operation is not desirable. The structure in Odoo and cloud will differ (as the folder will not be returned to its place and will not trigger the moving in Odoo (The warning in the sync logs will appear). For example, let's move the folder 'S00003' from the folder 'Quotations' to the general folder 'Odoo'. In the Files Manager, in Odoo no changes will take place, however, the sync will continue and the folder will stay in the same place, in the root Odoo folder. In the sync logs a warning will appear.


4. Delete a folder

Performing such an operation is not desirable. If you try to delete the folder in a cloud client, then after the next direct sync, the folder with child folders will be recreated. But, as the files were stored in the cloud client and were deleted - they will not be recovered. In Odoo, the broken links will remain.

The folder changes in Odoo are prioritized over the folder changes in a cloud client.  

For example, if we delete a folder 'Quotations' permanently, then with the next sync the folder with child folders (S00001, S00003, S00012, etc.) will be recreated. However, the files will be lost as they were kept in the cloud.

Avoid renaming, moving, and deleting folders in the client. They should be managed in Odoo.


Files Sync

After the sync, the attachments of each folder (and hence, related Odoo object) will be moved to the related folder in the cloud client. For example, Odoo > Customers > Azure Interior > scan1.jpeg. Only links to the files will be kept in Odoo.

As with folders, certain actions have a different result depending on the place, where the changes are introduced (in Odoo or in a Client). When considering files and changes in them, the changes applied in the cloud client are prioritized over the changes in Odoo.

Let's see some common actions performed on the files and their consequences:

1. Upload files to Odoo / Upload files and folders to Cloud

If you upload files to Odoo, then those files will be transferred to the cloud client. Only links to them will remain in Odoo. You still will be able to access the file quickly, just by clicking on it in Odoo.

In case, you upload the files to the cloud client directly, the app will create URL attachments for those items in a linked Odoo folder.

In cloud client folders, you can put not only files but child folders as well. In that case, with the next sync, the folder will be created in Odoo and it will be seen from the object's attachments box and in the files storage as well.

For example, let's upload some files to the folder 'Azure Interior' through Files Manager in Odoo, and let's add a folder with files to the folder 'Deco Addict' in the cloud client. After the sync, all files will be kept in the cloud client, while the links to them will remain in Odoo.



2. Rename a file in Odoo / Cloud

If you rename a file in the cloud client, then the chained Odoo attachment will be also renamed. For example, let's rename the file '1.docx' to 'Plan for the team' in the cloud client. After the next sync, it will be renamed in Odoo as well.

You can also rename an attachment in Odoo. For that, click on the attachment thumbnail and you will be redirected to the attachment card. There, introduce the new name. The changes will be reflected in the cloud as well.

If you rename a file in both Odoo and Cloud at the same time, the changes in Odoo are prior.


3. Move a file in Odoo / Cloud

If you move a file from the cloud client from one object to another, a linked Odoo attachment would be also moved.

For example, let's move the file 'type.gif' from the folder S00018 to the folder 'Quotations'. With the next sync, it will be moved in Odoo as well.

You can move an attachment to another folder in Odoo with the help of the Mass action 'Update'. For that, just select the file/files, click 'Update' and choose the folder to move the file/files to. Then, the file will be moved in the cloud client accordingly.

If you move a file in both Odoo and Cloud at the same time, the changes in Odoo are prior.


4. Delete a file from Odoo / Cloud

If you delete a URL attachment from Odoo, it will also be deleted from the cloud client.

If you delete a file from the cloud client, a linked Odoo attachment would be also deleted.

For example, let's delete a file from the folder 'Azure Interior' in Odoo and the Deco Addict's file from the cloud client. With the next sync, the deleted files will be removed from both Odoo and the cloud client, regardless of the place where you deleted them.


5. Download files from Odoo / Cloud

Regardless of the place, you can always download any attachment. To download the attachment from Odoo, just click on the 'Download' icon, and the downloading will start automatically. To download a file from the client, click on the file and choose the appropriate command.

For example, let's download the file 'sync.logs' from Odoo and the file 'faotools' from the cloud client.



Reconnection​


As you configure a cloud client, the button 'Reconnect/Pause' appears in the top left corner. It is useful when:

1. A cloud client wasn't used for a while (for example, sometimes, when Google Drive is not used for a while you need to reconnect and give all the permissions again to continue using it.)

2. The sync has stopped (for example, when there was an error while syncing) a token has expired (for example, OneDrive's token is usually valid only for 6 months and then it is necessary to generate a new one, and reconnect)

3. Granting extra permissions is required (for example, when terms of the agreement were changed and it is necessary to give permission to manage files in a cloud client)

4. For migration purposes (for example, when a new version of Odoo comes out and you need to apply some changes on the platform)

5. You want to stop the sync (for example, when you configured several cloud clients and to boost the sync process of one of them you stop the other)

To reconnect the cloud client:

1. Press the button 'Reconnect'

2. Press the button 'Login and confirm'

3. Follow the instruction related to the target cloud client.




Resetting or changing cloud client: reverse sync


Reverse sync takes place, when a folder isn't anymore synced, when you want to change the cloud client of previously synced files and folder, or when the sync is fully stopped (cloud is reset).

It assumes getting all items back to Odoo, deleting the files from the cloud client, and optionally sending them to another one.

The reverse sync is triggered by the same scheduled job as the direct and the backward sync 'Run/Prepare sync queue'. It can be also triggered manually, by clicking on the button 'Launch sync'.

Reverse sync operations are usually prioritized over direct and backward sync operations. Thus, in most cases, the planner will work with the tasks related to reverse sync until they are fulfilled, and only after that will continue completing the other tasks. Not all items can be correctly reverse to Odoo due to cloud client peculiarities. For example, there are documents that may exist only in cloud storage environments (e.g. Google Sheet). The app would try to convert such documents, but in some cases, it would require manual interactions.

Try to avoid using the reverse sync. Make sure you really need it.




Sync Logs​


For extra convenience, the special sync logs interface was introduced. It allows you to control planned jobs and their fulfillment. With the help of the information from the sync logs, you will be able to:

1. See the sync history

2. Know, whether the sync took place, and what has changed

3. Check, whether a particular file was synchronized

4. Investigate the sync problems.

The sync history contains all the necessary information, about all the actions of the module. For example, what folders were created, what files were imported or exported, and by what cloud. The time of the action is also tracked, so you may see when the action took place. The time of sync logs corresponds to the time of the Odoo server, thus, it may differ from the local time of the user.

To open the sync logs interface go to Cloud Storage > Configuration > Sync Logs. There you will be able to see the list of changes, which take place while syncing. You can also see it in real-time, as the objects and files are managed.

One of the most important functions of the Sync Logs is to point out the problem in sync. If there is a problem - a mistake and its details will appear in the sync logs. From here you may find out what actions to take or may export the logs, in order to send to the customer support email for further investigation of an issue. Depending on the result of the sync, the sync operation may be either green (if it was successful), orange (for warning, if there was an unserious error), or red (if there was an error).

The button 'Export all logs' was introduced to share sync logs in case an error appears. This way, you will be able to send the logs to a responsible person, who will be able to fix the problems in time.

If you have more than one cloud client, then you will be able to see all logs at once or only of one/several clients. Just click on a slider button by the cloud. 

When there are a lot of files synchronizing every day, it might be rather difficult to find the information you need through Sync Logs. Therefore there are several ways to conveniently search the sync records. The ways to search Sync Logs:

1. By matches in Logs or cloud clients' names. For that, just start writing your request in the search field in the top left corner and click on the search icon. It is also possible to search logs for a particular date. Just add it to the search field in the format '2022-11-24'.

2. By applying Log Levels in the left side of the interface, by clicking on the slider button. The available ones are: Critical, Error, Warning, Info, Debug.  

If you click on the 'Export' button after selecting a cloud client or applying the particular filters, then only matching sync logs will be exported.


To find the acute sync logs faster and don't take up a lot of server space, you may limit the number of days for which the sync logs are kept. To define how many days sync logs should be kept in Odoo, go to Cloud Storage >Configuration >Configuration and specify the number of days in the field 'Logs storage period (days)'. The number should not be less than 3 days.

You can also subscribe for a particular cloud client's notifications, so if there is a critical connection error you will receive an email and will be able to fix the problem in time. For that: go to Configuration > Cloud Clients, open one of them, and click 'Subscribe' in the bottom right corner.

Sync Logs do not assume to replace Odoo server logs. It is a complementary function, which allows controlling sync from the configuration interface. You may need Odoo server logs as well, to investigate the roots of detected in Sync Logs warnings.

Sync Logs do not assume replacing Odoo server logs.




Google Drive Implementation


Google Drive is a cloud-based storage solution made by Google. It allows saving files online, so you can access them anywhere from any device. With the help of Google Drive, you can access and manage your files securely. The tool has a lot of useful collaborative tools and built-in integrations, which make this cloud client popular among users.

Google Drive Odoo Integration is a tool to integrate Google Drive features into your Odoo business workflow. The app automatically stores Odoo attachments in Google Drive, and it provides instant access to them via web links. In such a way users work with files comfortably in the cloud storage, while the results are fully available in Odoo.

Sync works both for individual and team drives (Google Suite business and enterprise tariffs). In the latter case, the root folder Odoo is placed within a chosen team drive, in the former case - within a current user drive.

Configuration and Log in

After the installation of the module in your database, it is required to finish the setup by doing the following:

1. Go to the Google Developer Console via the URL: https://console.developers.google.com

If it is your first time on the platform, you will be asked to agree to the Terms of Service and Email update. The mandatory one is only the Terms of Service.

2. Select or create a project After clicking on the button 'Create Project', the new form will appear. There you need to write the title of the project, optionally add your organization, and click 'Create'.

3.  From the project's dashboard go to API's overview and press 'ENABLE APIS AND SERVICES'

4. Find Google Drive API and push the button to enable its API

5. Go to 'Credentials' and press the button 'Configure Consent Screen'.

6. As the User Type select 'External' and push 'Create'

7. Add app information

8. As an app name select any suitable and as a user support email select your email

9. In the field Developer contact information add your email address again and press 'Save and Continue'

10. On the 'Scopes' page just press 'Save and Continue'

11. As Test Users add your Gmail email address by clicking on the button '+Add users', then press 'Save and Continue'

12. Then, go to Credentials and push the button 'Create Credentials', in the list choose 'OAuth client ID'

13. As the application type choose 'Web application', as the authorized redirect URI add the link in a format [YOURODOOSITENAME]/google_drive_token (for example, https://odootools.com/google_drive_token).

14. Save the app and copy 'Client ID' and 'Client Secret'

15. Go to the Cloud Storage > Configuration > Cloud Clients and click 'New'

16. Choose Google Drive from the list of available cloud clients

17. Optionally type the root folder name, otherwise, the default one 'Odoo' will be used

18. Copy&Paste 'Client ID' to the 'App Client ID'

19. Copy&Paste 'Client Secret' into the field 'App Secret Key'

20. Insert previously generated redirect URL

21*. If you use team drives, check the related box.

Make sure you really use team drives. In your Google Drive, you should find the item 'Team Drives' in the left sidebar. This feature is available only for business and enterprise tariffs.

If the option 'Team Drive' is enabled, introduce its name. It should be absolutely the same as you see it in your Google Drive. Make sure that your user has full rights to all team drives.

If you configure a team drive account, make sure, that your user has full rights to all team drives. Usually, it is the admin user, who have set the Google account up.

22. Press 'Confirm' to connect to the cloud.

After that, you will be redirected to the Google login page. Check-in, agree with all conditions, and grant permissions asked.

After login, Google redirects you back to Odoo. Google Drive - Odoo synchronization is ready to be done.

After the successful setup, you will be redirected back to the module's settings. You will see the interface, which includes two buttons 'Reconnect/Pause' and 'Reset'. You can use them to stop the sync and to return the files and folders back to Odoo (see Reconnection, Resetting or changing cloud client: reverse sync).

Reconnection

Reconnection might be required in case the client wasn't used for a while and when you migrate the app from previous versions. In such a case:

1. Press the button 'Reconnect/Pause'

2. Press the button 'Confirm'.


Peculiarities

1. In order to delete a folder or a file from Google Drive, it is necessary to delete it from the bin as well. Otherwise, it will continue being synced in the bin.

2. Sometimes Google Drive revokes the token. In this case, you just need to reconnect the cloud client, by clicking the button 'Reconnect'. 

If the configured Google App is in the 'testing stage' its refresh tokens will expire exactly within a week. To significantly increase token duration, go to the Google developer console > select your Project > OAuth consent screen and find the section 'Publishing status'. If it is 'Testing', change that to 'In Production'.



OneDrive/SharePoint Implementation


OneDrive is a file hosting service and synchronization service operated by Microsoft. It allows users to share and synchronize their files. Users, whose computers operate on Windows 10 see the OneDrive as they log in with their Microsoft Account.  The available storage can be found in File Explorer. In Microsoft computers, it’s the default option for saving documents or files, which can help save space on your storage drive.

SharePoint is a cloud-based service for businesses that provides various applications, and security features to empower business teams' work. Users can upload a document, which immediately will be shared with co-workers. They can also have their own personal storage space (OneDrive) where no one can see a document or file until it is shared with other users. SharePoint also gives the ability to control access to the stored information and automate workflow processes across business units to the company.

OneDrive/SharePoint Odoo Integration is a tool to integrate OneDrive/SharePoint features into your Odoo business workflow. The app automatically stores Odoo attachments in OneDrive/SharePoint, and it provides instant access to them via web links. In such a way users work with files comfortably in the cloud storage, while the results are fully available in Odoo.

Sync works both for personal OneDrives and business SharePoint tariffs.

Python Dependency

The tool depends on external libraries 'microsoftgraph'. Install this library for your Odoo server through the command: pip3 install microsoftgraph-python

Make sure that you are installing the package for the correct Python, so for the same one on which Odoo is run. Usually, that assumes running the command under sudo. Contact your system administrator if after installation Odoo cannot anyway detect the library.

Configuration and Log in

Before the configuration, make sure your Microsoft user has full admin rights for OneDrive/SharePoint you want to connect to Odoo. This user is required only to grant permissions, the user data would not be kept anywhere in Odoo, and would not be used anymore. Also, make sure a Microsoft email address you use does not have a redirection (usually happens when you configure your domain name, while the prime address is still one of Microsoft domains like @outlook.com, @office365, etc.).

While configuring OneDrive/SharePoint account, make sure, that your user has full rights to it. Usually, it is the admin user, who have set the OneDrive/SharePoint account up.

After the installation of the module in your database, it is required to finish the setup by doing the following:

1. Go to your Azure Portal: https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade

2. Click 'New registration'

3. Introduce a new name for the application

4. As the supported account types choose 'Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)'

5. Assign the redirect URI as [YOURODOOSITENAME]/one_drive_token (e.g. https://odootools.com/one_drive_token) and click 'Register'

6. Go to the Cloud Storage > Configuration > cloud clients and click 'New'

7. Choose OneDrive or SharePoint from the list of available cloud clients

8. Optionally type the root folder name, otherwise, the default one 'Odoo' will be used

9. Copy the Application Client ID to the Odoo field 'App Client Id'

10. Go to Certificates & secrets - Click 'New Client Secret'. Copy the secret value to the Odoo field 'App Secret Key'

11. Press 'Confirm' on the Odoo configuration Page.

After that, you will be redirected to the Microsoft login page. Check-in, agree with all conditions, and grant permissions asked.

After the successful setup, you will be redirected back to the module's settings. You will see the interface, that includes two buttons 'Reconnect/Pause' and 'Reset'. You can use them to stop the sync and to return the files and folders back to Odoo (see Reconnection, Resetting or changing cloud client: reverse sync).

SharePoint configuration

The configuration of SharePoint is almost the same as of OneDrive. But you also need to specify the SharePoint site and SharePoint library parameters. So, in order to configure SharePoint:

1. Follow the steps 1-10 of OneDrive configuration instructions

2. Go to your SharePoint site and prepare a new documents library (drive). You might use one of the existing ones, e.g. 'Documents'. Odoo folder would be put there afterward, and it would be impossible to move it to another library.


3. In Odoo, while adding the cloud client, in the field 'Cloud client' choose 'SharePoint'

4. The SharePoint URL should be of the type https://[URL]/. The last '/' is required - the site name should not be included. For example, https://odootools.sharepoint.com/


5. SharePoint site should be either my_site_name (in that case it is considered as sites/my_site_name) or sites/my_site_name (instead of 'sites' it might be 'teams' and so on). There should be no '/' at the beginning or at the end. For example, sites/odootools

6. As Documents Library use one created in SharePoint


7. Then you need to establish the connection with SharePoint. For that, follow the steps 11-12 of OneDrive configuration instructions.

Reconnection

Reconnection is required, when you have not used the sync tool for more than 6 months. In such a case:

1. Press the button 'Reconnect/Pause'

2. Press the button 'Confirm'.



OwnCloud/Nextcloud Implementation


ownCloud is a file server that provides secure storage and tools for collaboration and sharing. Users can access the company's files quickly and easily from anywhere and from any device. ownCloud Community Edition is available for free as an Open Source software. As it runs on your own server the available storage space equals the amount of disk space on your server. There are some subscription plans available. 

Nextcloud is also free, open-source software, that operates on the ownCloud fork. It can be installed and operated on a private server and is suitable for both companies and individuals. In comparison with the ownCloud, the toolset of Nextcloud is wider and includes conferencing and groupware solutions.

Nextcloud/ownCloud Odoo Integration is a tool to integrate Nextcloud/ownCloud features into your Odoo business workflow. The app automatically stores Odoo attachments in Nextcloud/ownCloud, and it provides instant access to them via web links. In such a way users work with files comfortably in the cloud storage, while the results are fully available in Odoo.

Python Dependency

The tool depends on external libraries 'ownCloud'. Install this library for your Odoo server through the command: pip3 install pyocclient

Make sure that you are installing the package for the correct Python, so for the same one on which Odoo is run. Usually, that assumes running the command under sudo. Contact your system administrator if after installation Odoo cannot anyway detect the library.

Configuration and Log in

After the installation of the module in your database, it is required to finish the setup by doing the following:

1. Go to the Cloud Storage > Configuration > Cloud Clients and click 'New'

2. Choose ownCloud or Nextcloud from the list of available cloud clients

3. Optionally type the root folder name, otherwise, the default one 'Odoo' will be used

4. Enter your ownCloud / Nextcloud full URL

5. Select an ownCloud / Nextcloud user, which has full rights to read, create, write, and delete files and folders within a root directory

6. Enter the login and password of this user

If you configure a Nextcloud account, make sure, that your user has full rights to it. Usually, it is the admin user, who have set the account up.

7. Introduce the title for the ownCloud/Nextcloud folder, e.g. Odoo

8. Optionally tick the box 'Use Public URLs' (see Internal and Public URLs)

9. Click 'Confirm'.

After the successful setup, you will be redirected back to the module's settings. You will see the interface, which includes two buttons 'Reconnect/Pause' and 'Reset'. You can use them to stop the sync and to return the files and folders back to Odoo (see Reconnection, Resetting or changing cloud client: reverse sync).

Make sure that the root directory or its children are shared with your colleagues.

Reconnection

Reconnection might be required in case a refresh token is expired, and when you migrate the app from previous versions. In such a case:

1. Press the button 'Reconnect/Pause'

2. Press the button 'Confirm'.


Peculiarities

By default all links from Odoo to ownCloud / Nextcloud are internal. It means that only authorized users may access them and, after that, generate shared URLs for others.

It is possible to make them public using the option 'Use Public URLs'. In that case, links will become 'shared', meaning that everybody may access those files by links. Although the links would be hardly known by external users, there is a slight chance that they become available as a result of some user actions. Besides, sharing link generation is not fast and might make synchronization slower. Thus, be cautious if you decide to turn on the feature and use shared links.




DropBox Implementation


DropBox is a cloud storage system, which helps to synchronize and access files from any device. DropBox allows controlling permission levels and sharing files and folders with the help of the link, or making files public so anyone with the appropriate link can access them. There is also a possibility to create a Dropbox account for business.

DropBox Odoo Integration is the tool to integrate DropBox features into your Odoo business workflow. The app automatically stores Odoo attachments in DropBox, and it provides instant access to them via web links. In such a way users work with files comfortably in the cloud storage, while the results are fully available in Odoo.

Synchronization works for any DropBox tariff, including Personal DropBox (Basic, Plus, Family) and Business DropBox (Professional, Standard, Advanced).

Python Dependency

The tool depends on the external library 'dropbox'. Install this library for your Odoo server through the command: pip3 install dropbox

Make sure that you are installing the package for the correct Python, so for the same one on which Odoo is run. Usually, that assumes running the command under sudo. Contact your system administrator if after installation Odoo cannot anyway detect the library.

Configuration and Log in

After the installation of the module in your database, it is required to finish the setup by doing the following:

1. Follow the URL https://www.dropbox.com/developers/apps/create

2. Choose an API as 'Soped access'

3. Choose the type of access as 'Full Dropbox'

4. Select any suitable name for the app and push the button 'Create app'

5. Add the redirect URI as YOURODOOSITENAME]/dropbox_token (e.g. https://faotools.com/dropbox_token). A valid SSL certificate (https) is required

6. Go to the tab 'Permissions'

7. Grant permissions to the app: 'Account Info (Read)', 'Files and folders Metadata (Write) (Read)', 'Files Content (Write) (Read)', 'Collaboration (Write) (Read)'. For team DropBox assign also 'Team Data Members', 'Members (Read)'. Make sure no other permissions are assigned.

8. Click 'Submit'.

9. Go to the Cloud Storage > Configuration > Cloud Clients and click 'New'

10. Choose DropBox from the list of available cloud clients

11. Optionally type the root folder name, otherwise, the default one 'Odoo' will be used

12. Copy App Key, and App Secret, and redirect URI to the related fields in Odoo

 For team DropBoxes only:

  • Check the box 'DropBox Team' Set an email of DropBox user. Inside this user folder, all Odoo-related items would be created, and only after that, they will be shared with all other users. Under this user, all files and folders are created, changed, moved, and deleted

  • Choose a suitable name for the root Odoo folder, e.g. 'Odoo' or 'ERP'

13. Optionally tick the box 'No links to DropBox from Odoo' (see DropBox URLs)

14. Press 'Confirm'.

After that, you will be redirected to the DropBox login page. Check-in, agree with all conditions, and grant permissions asked.

If you did everything right, but a mistake appears as you 'login and confirm' to the account. Add and remove some permission and try to log in several times (Steps 7, 8, 12).

After the successful setup, you will be redirected back to the module's settings. You will see the interface, which includes two buttons 'Reconnect/Pause' and 'Reset'. You can use them to stop the sync and to return the files and folders back to Odoo (see Reconnection, Resetting or changing cloud client: reverse sync).

Reconnection

Reconnection might be required in case a refresh token is expired and when you migrate the app from previous versions. In such a case:

1. Press the button 'Reconnect/Pause'

2. Press the button 'Confirm'.

Peculiarities

DropBox has a specific way to generate links for existing files and folders. In particular, there are no concepts of internal or private URLs. Instead, each DropBox item might get a so-called shared URL. Such shared links are either public or team-only. Moreover, the latter feature is available only for DropBox business accounts.

This tool relies upon share links' mechanics. It means, that each attachment link is either public (all personal DropBox accounts) or team-only (all business DropBox accounts).

Sometimes it is considered to be not fully safe. Although website URLs will be hardly known by external users, there is a slight chance that they become available as a result of some user actions. Besides, sharing link generation is not super fast and might make theIr sync process slower. That is why the feature to switch off sharing URLs is introduced.

If checked, all DropBox URLs in Odoo will be of type https://www.dropbox.com/home/Odoo/[PATH]. Such links will not work in quite many cases. For example, you will not be able to use the button 'Open in Cloud'. Also, you will not be able to open such formats as .xlsx, which cannot be opened through the standard Odoo reviewers. For that, authorization will be required.

Thus, if you need to open DropBox files/folders from Odoo, do not turn on the feature 'No links to DropBox from Odoo'.




Access Rights


The module introduces two new user groups, which can see and manage the menu Cloud Storage: File Manager Access and Administration.

To observe the menu 'Cloud Storage' and the app Files Manager, a user should belong to the security group 'Cloud Storage > File Manager Access'.

To configure automatic folder rules, establish connections with various cloud clients, control sync logs, and apply the app settings, a user should belong to the security group 'Cloud Storage > Administration'.

To assign one of the roles to a user:

1. Go to Settings > Manage Users

2. Choose a particular user

3. Scroll to the section 'Productivity'

4. In the field 'Cloud Storage' choose one of the options.


A user without the cloud storage rights assigned can't open the Files Manager interface but can see folders with files in the attachments box. This way he/she will have access to the object's files, including the synced ones if he/she has access to the object itself.

To access any folder in Files Manager, a user should be able to access all its parents. For example, if Anita Oliver has rights for employees but does not have for departments, then she might not read 'Odoo > Departments > Administration > Employees > Mitchel Admin'. However, if the folder 'Employees' becomes a stand-alone folder without a parent, then Anita would be able to access 'Odoo > Employees > Mitchel Admin'.

Access for each Odoo automatic folder is regulated based on a linked object. If such an Odoo object is available for a specific user, its directory would be also available for her/him. For example, if Anita Olivier is the task manager of 'Prepare specification', then she may access the folder 'Tasks' and 'Tasks > Prepare Specification'.

Access to Odoo manual folders is regulated based on the parent-child relationship. If you have access to a parent folder, then you also have access to its children.

Restricting access to a particular manual folder is an additional way to limit access rights to make a folder even more secure. Define the users or user groups in the manual folder's settings, so no one else could access it.

If nobody is specified then a manually created folder is available for everyone. For example, if Anita Oliver is a sales manager, she may access the quotation-related folder 'Odoo > Orders > SO-001'.

To manage access to a manually created folder:

1. Click on any manually created folder with the right side of the mouse

2. Choose the option 'Edit Settings'

3. Go to the tab 'Extra security'

4. Specify the users and groups, who can see the folder

5. Click 'Save&Close'.

Keep in mind, that the creator of the folder should be also added to the list to access the folder.


The app does not regulate access levels for cloud clients and their items. The tool regulates rights only for Odoo objects and synchronizes those to required storage. After the sync, if it is necessary, you should apply the settings for a target cloud client, folders, and files.



Odoo server configuration


Proper database and server setup are required to provide enough resources for sync operations and to avoid slowdowns of queue processing. It also minimizes the risks of concurrent updates and conflict errors in API requests. For that, apply proper timeouts to the Odoo configuration file: LIMIT_TIME_CPU, LIMIT_TIME_REAL & LIMIT_TIME_REAL_CRON. They should be more or equal 900 seconds, in order to give enough time for sync and to forbid the server to cut it earlier.

If you use Odoo.sh, then you don't need to configure Server Timeouts, since they are predefined and not configurable  

Avoid also changing the frequency of cron jobs assumed by the app: '[Cloud Storage] Prepare Cloud Folders', '[Cloud Storage] Run / Prepare sync queue'. Those jobs are configured to be run each 15 minutes, and that frequency is used in the algorithms to avoid breaks and data losses. If you need to stop sync for a while, pause particular cloud clients instead.

On the module's configuration page, you will find the buttons for triggering the folder update and synchronization. However, push the buttons only to configure the cloud client and for testing purposes. Avoid pushing the buttons also when the cron is active and running. Give enough time for the system to finish one of the processes before manually triggering the second one (f.e. don't click both buttons at once, wait at least 10 minutes depending on the number of folders).

Don't trigger the sync manually by clicking on the buttons 'Launch folders' update' and 'Launch sync' to avoid errors. These buttons can be used for the first or test syncs only.



Extra notes


The module is based on API requests to the third-party service (cloud client). The more the sync scope (number of synced objects & files), the more requests the app has to send. Moreover, each sync requires special checks (for example, the access request to the cloud storage). Each request might take a significant amount of time compared with similar requests within the Odoo platform. Such communication between systems is risky by concept due to possible disconnections, API updates, and unsolvable conflicts. The app is designed to cope with such risks by carefully processing failures and checking cloud client states. Simultaneously, make sure that you have configured a proper backup strategy for both Odoo and cloud clients.

The special factors of risks are sync scope and reverse operations. The higher the sync scope is, the more it would take Odoo to finish integrations. Hence, more space for errors exists. Try to decrease sync scope logically by choosing only required folders. Reverse operations might be risky since assume reflecting cloud clients' features which might be absent in Odoo. For example, Google Sheets cannot be opened outside Google Docs. The app would try to solve the scenarios by applying similar features (e.g. by converting a file to simple electronic tables). However, that is not always possible, and in this way, manual interactions would be required.

The app assumes automatic regular synchronization with various cloud clients. Please take into account that synchronization is not real-time but is based on tasks' queues and scheduled jobs (see Odoo server configuration). Depending on the number of folders and attachments, it might take time for the app to check all directories and do the jobs. That's why, until the sync is done, Odoo attachment interfaces work as in standard Odoo.

The module provides the FIFO (first in - first out) logic of the sync. That means, the files are uploaded based on the queue: the oldest changes are reflected first. Therefore, not a single file is lost and the system resources are efficiently used. Even if you have a lot of files, they all will be synced for a particular time (see Odoo server configuration). For example, you have 10000 sale orders to sync and 15 minutes of time until the system time out. After 15 minutes, 3000 files are synced. Then during the next sync, 3000 more are synced. Therefore, to sync all the files several synchronizations will be required.

However, such a huge number of files to sync may lead to a long wait and, under some circumstances, to some errors. So, it would be better, to limit the synchronization amount with the help of filters by fields and periods. For example, you can sync only sale orders for August, or sync only sale orders with a total of more than 50000$. The folder rules' configuration lets you restrict the sync of obsolete items (e.g. there is no sense to sync archived partners or orders which are done 2 years ago) (see Filters & Periods).