Automated backups in Odoo

Hi guys,

In this tutorial I will learn you how to automatically take backups in Odoo, thanks to my backup module that integrates with Odoo.
There are two ways to install it, the first is through the app store and the second is by downloading it from Github.
In this guide I will explain you how to install it through Github since I like to do things myself and this will learn you how everything works. So let us start!

First download the module from Github. You can find it here. After you’ve downloaded it navigate to your Downloads folder and you’ll find a ZIP there.
Backup module download folder
Unzip this folder, you’ll now have a folder named “auto_backup-8.0”. Open this folder and you’ll see a new folder inside it named “auto_backups”.
Backup module itself
This is the actual module you will need to place inside Odoo. Now navigate to where your Odoo is located and paste the folder “auto_backup” in the “addons” folder. Like this:
Backup module in addons folder

Now that the module is under your addons folder you should first install pysftp. Pysftp is a module that offers the ability to handle all SFTP requests. My module needs this to connect to an external server, through FTP. Open up an Ubuntu terminal and run the following command:

After this you can update your module list by clicking on ‘Update Modules List’ under Settings.
Update module list
Now to go Settings > Local Modules and search for ‘Backup’.
You will see the following screen:
Module screen
Install the module from here or open up the details and then click on install.

After that the module is installed you will see a new menu item named ‘Configure Backup’ under Settings > Configuration.
New menu item
Click on this menu item and you will now see a tree view showing up. Now click on the ‘Create’ button to create a new backup.
Configure backup tree view

Now comes the greatest part, configuring the backup!
After clicking on the ‘Create’ button you will see a new screen which is almost fully filled in by default.
Configuration backup screen
Lets go over the fields one by one.

Local backup configuration:

  • Host: This is the name that you use on your local server to open up Odoo. For example if you have a local Ubuntu VM with an Odoo that you can access from http://localhost:8069/ you should fill in localhost (which is correct in 99% of the cases)! If you have http://anothername:8069/ you should fill in anothername.
  • Database: The name of the database which you want to backup. This is automatically filled in for the database you’re logged in with and should always be correct.
  • Port: The port where your Odoo runs on, on your local server! Again, open it up in your local server and take the port you use in the URL here.
  • Backup Directory: The folder where you’d like to write your backup to (locally). If you want it under /odoo/backups you write /odoo/backups.
    TIP: Be sure that the first level of the path is created (/odoo in this example) since this is directly under root and this cannot be forced. From there on Odoo can create the folders you’d like, provided that the user has enough access rights to write!
  • Auto.Remove Backups: If you check this option a new field will show up where you can specify how long you want to save backups locally. If this option is not checked the local backups will be stored forever and will not be automatically removed!
  • Remove after x days: The number that you fill in here will be the number of days that your backup should be kept locally. If you fill in 0 they will be automatically removed but can still be written to an FTP! Without keeping a local backup.


  • Write to external server with sftp: When you check this option you can write to an external FTP. After checking this option you will see a list of options showing up:
    SFTP details
  • IP Address SFTP Server: The IP address of your external FTP server. For example:
  • Username SFTP Server: The username where the module should login with on your external server.
  • Password User SFTP Server: The password for the user where the module should authenticate with.
  • Path external server: The absolute path where the backups should be written to on the remote FTP server. TIP: Be sure that the first folder exists if it is directly under / since the module does not have rights for this. Make sure that the user where the module logs in with also has read and write rights, so it can create folders if they don’t exist yet.
  • Remove SFTP after x days: Give in the number of days you want to keep the backups on your FTP server. All files that are longer on the FTP than the days will be automatically removed.
  • Auto. Email on backup fail: When you check this option you will automatically get an e-mail if the remote backup fails. After checking this a new field will show up where you can fill in your e-mail.TIP: You need to have an outgoing mailserver configured for this! If you do not know how check out this guide I wrote.
  • E-mail to notify: The e-mailaddress where you want to be notified in case a backup fails.

After configuring everything you should get something along this lines:
Configured backup screen
Now check if you configured everything correctly by clicking on the button ‘Test SFTP Connection’. If you get a message saying “Everything seems properly set up for FTP back-ups!” you’re almost done. If you get another message it should tell you what is wrong, just fix it!
Correctly configured

Configuring the automated action

Alright, we’re almost done! The only thing left to do now it to activate the automated action. Go to Settings > Automation > Scheduled Actions. You will see an item in the list named ‘Backup scheduler’ that is grayed out, which means it has to be activated.
Scheduled Actions
Open up the record and check the box ‘Active’ so the action will automatically run. Configure how often you wish to take a backup by specifying the ‘Interval Number’ and the ‘Interval Unit’. For example to take one backup every day at 12:00:
Daily backup configuration
Now save this and from now on all your backups will be taken automatically as you’ve configured them!

Having any problems? Liking the module? Want to give feedback? Post away! 😀
The module is available on the Odoo app store or you can get the source code from Github
Tutorial sponsored by Oocademy