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.

SFTP:

  • 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: 10.0.11.15
  • 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




Odoo Experts

Install wkhtmltopdf on Ubuntu

Hi guys,

In this tutorial I will learn you how to install Wkhtmltopdf on Ubuntu. You will need Wkhtmltopdf to print out PDF reports in your Odoo or you will get a warning message saying that you don’t have Wkhtmltopdf.
There are two ways to install Wkhtmltopdf. Method #1 is through an executable file and method #2 is by command. If you do not care about technical details and how it works simply read on. Want to know the technical details and learn how to do it yourself? Then start reading from chapter 2.

1. Install Wkhtmltopdf through executable script

Open up your Ubuntu terminal and create a new .sh file

Now add the following code in it:

The next step is to make the file executable

And finally, now it is executable, execute it.

After the script is done you will see something along these lines:
Installed wkhtmltopdf on Ubuntu
After restarting your Odoo/Ubuntu you will be able to use Wkhtmltopdf and print PDF files.

2. Install Wkhtmltopdf manually from the terminal

So you don’t want to install it automatically but learn more about this? Lets start!
The first thing you need to do is download the Wkhtmltopdf files from the website. wget -P will download these files.

This is telling Ubuntu to download the files from the website with sudo (administrator) rights and to place them in the Downloads folder.
Now that you have the files in your Downloads folder you should navigate to them

The next step is to install it by dpkg. Dpkg is the package installer from Ubuntu and will be responsible for installing/removing files.
So lets install the package.

Now that it is installed you still need to move the wkhtmltopdf and wkhtmltoimage files under /usr/bin/ to make Wkhtmltopdf work with Ubuntu and accessible for the user. First navigate to the correct folder

Now copy the files from your Downloads folder to your bin so that they can be used by your Odoo.

When you now reload your Odoo or restart the server you can use Wkhtmltopdf and PDF’s will be generated automatically!




Odoo Experts

Install Odoo 8 on Ubuntu 14.04

Hi guys,

In this tutorial I will learn you how to install Odoo 8 on Ubuntu 14.04, thanks to a script from André Schenkels.
The first step is to create a new .sh file on your Ubuntu machine, wherever you’d like this.
For example right under /home. Open up an Ubuntu terminal and cd to the directory where you’d like to keep the script and then create the file.

Next add the following code in to the file:

There are some things you can configure/change to your likings. If you’d like Odoo 7 you should change OE_VERSION=”8.0″ to “7.0”. Be sure to change the Odoo super administrator password out of safety.
The next step is to make this file executable. After you’ve made it executable you can execute it and everything will be installed automaticly.
do this with the following command:

Now that the file is executable simply run the execute command ./ and the Odoo will be installed automaticly!

Give this a while since it will need to download all dependencies, download Odoo and install it.
Browse to http://localhost:8069/ and you’ll see you have a brand new Odoo 8 installed.
New Odoo
Want to stop/start/reload the Odoo session?

Tip: Want to see the source code from the script and find other variants? Have a look here.




Odoo Experts