Skip to content

Commit

Permalink
[auto_backup] Refactor.
Browse files Browse the repository at this point in the history
- Follow template README.
- Remove HTML README.
- Move models to models folder.
- Model and view file names follow guidelines.
- Unused methods cleanup.
- Remove unneeded `.pot` file.
- Fix permissons.
- Follow PEP8 in names everywhere.
- Set more descriptive field names.
- Disable backups for other databases, for security.
- Remove db name from generated file, for easier cleanup.
- EAFP logic everywhere.
- More descriptive name.
- Data files moved to YAML, with cleaner ir.cron record creation.
- Add permissions for db.backup model.
- Icons.
- Update tests with new format.
- Storage method is a selectable, for easier extensibility.
- Instead of custom mailing, it just has a mail thread where you can subscribe.
- Should fix almost all comments in OCA#203.
- Reduce headers.

This respects the upstream license choice (GPL/AGPL) but reduces
verbosity.

It would be ideal to have everything under AGPL though.
  • Loading branch information
Jairo Llopis authored and jcmontoyach committed Oct 8, 2019
1 parent d1bed5e commit a9afd7a
Show file tree
Hide file tree
Showing 18 changed files with 542 additions and 889 deletions.
44 changes: 25 additions & 19 deletions auto_backup/README.rst
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

=================
Automated backups
=================
====================
Database Auto-Backup
====================

A tool for all your back-ups, internal and external!

Installation
============

Before to install this module, you need to:
Before installing this module, you need to execute::

instal pysftp via pip.
pip install pysftp

Configuration
=============

Go to Settings -> Configuration -> Configure Backup
Go to *Settings -> Configuration -> Configure Backup* to
create your configurations for each database that you needed
to backups.

Usage
=====


Keep your Odoo data safe with this module. Take automated back-ups,
remove them automatically and even write them to an external server
through an encrypted tunnel. You can even specify how long local backups
and external backups should be kept, automatically!


Connect with an FTP Server
--------------------------

#### Keep your data safe, through an SSH tunnel!
Keep your data safe, through an SSH tunnel!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Want to go even further and write your backups to an external server?
You can with this module! Specify the credentials to the server, specify
Expand All @@ -45,7 +45,8 @@ safe!
Test connection
---------------

#### Checks your credentials in one click
Checks your credentials in one click
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Want to make sure if the connection details are correct and if Odoo can
automatically write them to the remote server? Simply click on the ‘Test
Expand All @@ -55,16 +56,21 @@ everything is OK, or what is wrong!
E-mail on backup failure
------------------------

#### Stay informed of problems, automatically!
Stay informed of problems, automatically!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Do you want to know if the database backup failed? Check the checkbox 'Auto. E-mail on backup fail' and fill in your e-mail.
Every time a backup fails you will get an e-mail in your mailbox with technical details.
Do you want to know if the database backup succeeded or failed? Subscribe to
the corresponding backup setting notification type.

Run backups when you want
-------------------------

Known issues / Roadmap
======================
From the backups configuration list, press *More > Execute backup(s)* to
manually execute the selected processes.

* ...
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/8.0

Bug Tracker
===========
Expand All @@ -74,7 +80,6 @@ In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
`here <https://github.com/OCA/server-tools/issues/new?body=module:%20auto_backup%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.


Credits
=======

Expand All @@ -83,6 +88,7 @@ Contributors

* Yenthe Van Ginneken <[email protected]>
* Alessio Gerace <[email protected]>
* Jairo Llopis <[email protected]>

Maintainer
----------
Expand All @@ -97,4 +103,4 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit http://odoo-community.org.
To contribute to this module, please visit https://odoo-community.org.
29 changes: 6 additions & 23 deletions auto_backup/__init__.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
# Copyright (C) 2015 Agile Business Group <http://www.agilebg.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2004-2009 Tiny SPRL (<http://tiny.be>).
# © 2015 Agile Business Group <http://www.agilebg.com>
# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License GPL-3.0 or later (http://www.gnu.org/licenses/gpl.html).

from . import model
from . import tests
from . import models
38 changes: 13 additions & 25 deletions auto_backup/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,31 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
# Copyright (C) 2015 Agile Business Group <http://www.agilebg.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2004-2009 Tiny SPRL (<http://tiny.be>).
# © 2015 Agile Business Group <http://www.agilebg.com>
# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License GPL-3.0 or later (http://www.gnu.org/licenses/gpl.html).

{
"name": "Database Auto-Backup",
"summary": "Backups database",
"version": "8.0.1.0.0",
"author": (
"VanRoey.be - Yenthe Van Ginneken, Agile Business Group,"
" Grupo ESOC Ingeniería de Servicios,"
" Odoo Community Association (OCA)"
),
'license': "AGPL-3",
"website": "http://www.vanroey.be/applications/bedrijfsbeheer/odoo",
"category": "Tools",
"summary": "Backups data base",
"depends": ['email_template'],
"demo": [],
"data": [
"view/bkp_conf_view.xml",
"data/backup_data.xml",
"security/ir.model.access.csv"
"data/backup_data.yml",
"security/ir.model.access.csv",
"view/db_backup_view.xml",
],
"application": True,
"installable": True
"installable": True,
"external_dependencies": {
"python": ["pysftp"],
},
}
18 changes: 0 additions & 18 deletions auto_backup/data/backup_data.xml

This file was deleted.

28 changes: 28 additions & 0 deletions auto_backup/data/backup_data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

# Cron job
- !record {model: ir.cron, id: ir_cron_backupscheduler0}:
name: Backup scheduler
user_id: base.user_root
interval_number: 1
interval_type: days
numbercall: -1
nextcall: !eval
(datetime.now() + timedelta(days=1)).strftime("%Y-%m-%d 02:00:00")
model: db.backup
function: action_backup_all

# New message subtypes
- !record {model: mail.message.subtype, id: success}:
name: Backup successful
res_model: db.backup
default: False
description: Database backup succeeded.

- !record {model: mail.message.subtype, id: failure}:
name: Backup failed
res_model: db.backup
default: True
description: Database backup failed.
141 changes: 0 additions & 141 deletions auto_backup/i18n/auto_backup.pot

This file was deleted.

Loading

0 comments on commit a9afd7a

Please sign in to comment.