Skip to content

RayMiles94/autobackup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Odoo Auto Backup Module

auto_backup is an Odoo module that allows you to automatically back up databases to a local directory or a remote server via SCP. It supports both .zip and .dump formats, scheduled backups, and retention management.


Features

  • Backup Odoo databases automatically or manually
  • Save backups locally or remotely over SSH (SCP)
  • Support for .zip and PostgreSQL .dump formats
  • Automatic cleanup of old backups based on retention days
  • Customizable backup filenames with timestamps
  • Uses sshpass for password-based SCP transfers if needed
  • Logs backup progress and errors

Installation

Prerequisites

  1. Python 3.x
  2. Odoo installed and configured
  3. sshpass (for remote SCP backups with passwords)

Install sshpass on Ubuntu(required for SSH mode)

sudo apt update
sudo apt install sshpass -y
  1. Ensure the Odoo user has write access to the backup directory.

Module Installation

  1. Place the module folder (auto_backup) in your Odoo addons directory.

  2. Update the Odoo apps list:

    sudo service odoo restart
  3. Go to Apps in the Odoo backend.

  4. Search for Auto Backup and install the module.


Activating Security for Users

To give a user access to the Auto Backup menus and features:

  1. Go to Settings → Users & Companies → Users.
  2. Open the user you want to grant access.
  3. In the Access Rights tab, find the Groups section.
  4. Assign the user to the Access group specific to Auto Backup.
  5. Save the user.

Once assigned, the user will see the Auto Backup menu in the Odoo backend and will be able to create or manage backup configurations according to their permissions.


Configuration

  1. Navigate to Settings → Auto Backup.

  2. Create a new backup configuration:

    • Backup Name: Custom name for your backup.
    • Active: Enable or disable this backup configuration.
    • SSH Login / Host / Password: Required for remote backups.
    • State: Select local or ssh.
    • Backup Path: Local or remote path for storing backups.
    • Backup Format: Choose .zip or .dump.
    • Master Password: Your Odoo master password.
    • Database Name: Optional; leave empty to back up the current database.
    • Retention Days: Number of days to keep backups.
  3. Save the configuration.


Usage

Manual Backup

Click Backup Now on a backup configuration to trigger an immediate backup.

Scheduled Backup

Use Odoo's Scheduled Actions to automatically run the scheduled_backup method at your preferred intervals.


File Naming

Backups are named automatically with the pattern:

<database_name>_YYYY-MM-DD_HH-MM-SS.zip

Example:

odoo_db_2026-01-31_14-01-03.zip

Notes

  • For remote backups, SSH key authentication is recommended.
  • Using sshpass for password authentication is less secure, but supported.
  • SCP is used to transfer backup files to remote servers.
  • Temporary backup files are automatically cleaned up after SCP transfer.
  • Local backups older than the retention period are deleted automatically.

Logging

Backup operations are logged using Odoo’s logger:

  • Successful backups
  • Failed backups
  • Deleted old backups
  • Errors during backup or SCP transfer

Security Considerations

  • Using passwords in plain text (sshpass) is insecure.
  • Prefer SSH key authentication for remote backups.
  • Ensure your backup directories are secure and have proper permissions.

License

MIT License – free to use and modify.

Releases

No releases published

Packages

 
 
 

Contributors

Languages