Skip to content

Commit 2798d45

Browse files
lasleyMaxime Chambreuil
authored andcommitted
[9.0][MIG] auto_backup (OCA#526)
* Update english pot file Added all the new fields and sentences. This will be the template for translations. * Dutch translations Full translation of the module to Dutch * Chinese translations Add Chinese translations to the module. Written by talway. * Changes chinese translation Changed some translations * Full German translations Thanks to Martin Schmid! * Typo fix could'nt > couldn't * Flemish translations Flemish translations are identical to Dutch. * Open FTP session on the last moment possible Used to open fp = open(file_path,'wb') a few lines before it was needed. This shouldn't be too much of a problem but opening and closing it right after eachother keeps the session open for less time and there are less chances on failure. * Porting module to OCA 8.0 * [FIX] module * [FIX] bug logger --> _logger call [FIX] Flake8 [RM] useless files * [FIX] Readme.rst * [FIX] defaults value * [FIX] rebased commit * [RM] description index.html * [RF] porting to new api [FIX] schedule_backup method [IMP] IT translation [IMP] tests * [FIX] test * [FIX] flake8 * [IMP] deps in travis.yml [FIX] flake8 * [FIX] flake8 and pylint * [FIX] name of file * [FIX] autoremove method [FIX] Contributors * [FIX] mail.tempale seems not work in cron task, replaced with direct call of mail.mail * [FIX] Readme * [FIX] review remarks * [FIX] handled ssl hosts [FIX] Flake8 * [FIX] handled ssl hosts [FIX] Flake8 * [FIX] fixed, last review remarks * [FIX] travis lint check * [FIX] backup only local db , beacause xmlrpc call of dump cause memory leak * [RM] useless field * [FIX] check_dd method [ADD] test case improved * [auto_backup] Refactor. - 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. * Update english pot file Added all the new fields and sentences. This will be the template for translations. * Dutch translations Full translation of the module to Dutch * Chinese translations Add Chinese translations to the module. Written by talway. * Changes chinese translation Changed some translations * Full German translations Thanks to Martin Schmid! * Typo fix could'nt > couldn't * Flemish translations Flemish translations are identical to Dutch. * Open FTP session on the last moment possible Used to open fp = open(file_path,'wb') a few lines before it was needed. This shouldn't be too much of a problem but opening and closing it right after eachother keeps the session open for less time and there are less chances on failure. * Porting module to OCA 8.0 * [FIX] module * [FIX] bug logger --> _logger call [FIX] Flake8 [RM] useless files * [FIX] Readme.rst * [FIX] defaults value * [FIX] rebased commit * [RM] description index.html * [RF] porting to new api [FIX] schedule_backup method [IMP] IT translation [IMP] tests * [FIX] test * [FIX] flake8 * [IMP] deps in travis.yml [FIX] flake8 * [FIX] flake8 and pylint * [FIX] name of file * [FIX] autoremove method [FIX] Contributors * [FIX] mail.tempale seems not work in cron task, replaced with direct call of mail.mail * [FIX] Readme * [FIX] review remarks * [FIX] handled ssl hosts [FIX] Flake8 * [FIX] handled ssl hosts [FIX] Flake8 * [FIX] fixed, last review remarks * [FIX] travis lint check * [FIX] backup only local db , beacause xmlrpc call of dump cause memory leak * [RM] useless field * [FIX] check_dd method [ADD] test case improved * [auto_backup] Refactor. - 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. * Fix view format. * Add shortcut to execute backups from the "More" menu. * Avoid duplicated backups. * Make sure you don't backup inside the filestore folder. The filestore is saved in the backup, so if you save the backup in the filestore, you'd end up with a huge backup that includes itself and the universe may collapse. * [FIX] This was removing all databases. * FIX License type * OCA Transbot updated translations from Transifex * OCA Transbot updated translations from Transifex * OCA Transbot updated translations from Transifex * [FIX] auto_backup: bad reference to field sftp_private_key (OCA#423) Bump module version to 8.0.1.0.1 * [FIX] auto_backup: Empty dump using sftp backup option (OCA#432) * [FIX] logger db_backup for pysftp (OCA#419) * OCA Transbot updated translations from Transifex * OCA Transbot updated translations from Transifex * OCA Transbot updated translations from Transifex * OCA Transbot updated translations from Transifex * [FIX] remove en.po that was erroneously created by transbot * [MIG] auto_backup: Migrate to v9 * Add self.ensure_ones * Add test coverage * [ADD] auto_backup: Test coverage * compute_name * check_folder * action_sftp_test_connection * action_backup - sftp * action_backup_all * sftp_connection * filename
1 parent 472ede0 commit 2798d45

27 files changed

+5460
-0
lines changed

auto_backup/README.rst

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
2+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
3+
:alt: License: AGPL-3
4+
5+
====================
6+
Database Auto-Backup
7+
====================
8+
9+
A tool for all your back-ups, internal and external!
10+
11+
Installation
12+
============
13+
14+
Before installing this module, you need to execute::
15+
16+
pip install pysftp
17+
18+
Configuration
19+
=============
20+
21+
Go to *Settings -> Configuration -> Configure Backup* to
22+
create your configurations for each database that you needed
23+
to backups.
24+
25+
Usage
26+
=====
27+
28+
Keep your Odoo data safe with this module. Take automated back-ups,
29+
remove them automatically and even write them to an external server
30+
through an encrypted tunnel. You can even specify how long local backups
31+
and external backups should be kept, automatically!
32+
33+
Connect with an FTP Server
34+
--------------------------
35+
36+
Keep your data safe, through an SSH tunnel!
37+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38+
39+
Want to go even further and write your backups to an external server?
40+
You can with this module! Specify the credentials to the server, specify
41+
a path and everything will be backed up automatically. This is done
42+
through an SSH (encrypted) tunnel, thanks to pysftp, so your data is
43+
safe!
44+
45+
Test connection
46+
---------------
47+
48+
Checks your credentials in one click
49+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50+
51+
Want to make sure if the connection details are correct and if Odoo can
52+
automatically write them to the remote server? Simply click on the ‘Test
53+
SFTP Connection’ button and you will get message telling you if
54+
everything is OK, or what is wrong!
55+
56+
E-mail on backup failure
57+
------------------------
58+
59+
Stay informed of problems, automatically!
60+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61+
62+
Do you want to know if the database backup succeeded or failed? Subscribe to
63+
the corresponding backup setting notification type.
64+
65+
Run backups when you want
66+
-------------------------
67+
68+
From the backups configuration list, press *More > Execute backup(s)* to
69+
manually execute the selected processes.
70+
71+
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
72+
:alt: Try me on Runbot
73+
:target: https://runbot.odoo-community.org/runbot/149/9.0
74+
75+
Bug Tracker
76+
===========
77+
78+
79+
Bugs are tracked on `GitHub Issues
80+
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
81+
check there if your issue has already been reported. If you spotted it first,
82+
help us smashing it by providing a detailed and welcomed feedback.
83+
84+
Credits
85+
=======
86+
87+
Contributors
88+
------------
89+
90+
* Yenthe Van Ginneken <[email protected]>
91+
* Alessio Gerace <[email protected]>
92+
* Jairo Llopis <[email protected]>
93+
* Dave Lasley <[email protected]>
94+
95+
Maintainer
96+
----------
97+
98+
.. image:: https://odoo-community.org/logo.png
99+
:alt: Odoo Community Association
100+
:target: https://odoo-community.org
101+
102+
This module is maintained by the OCA.
103+
104+
OCA, or the Odoo Community Association, is a nonprofit organization whose
105+
mission is to support the collaborative development of Odoo features and
106+
promote its widespread use.
107+
108+
To contribute to this module, please visit https://odoo-community.org.

auto_backup/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# -*- coding: utf-8 -*-
2+
# © 2004-2009 Tiny SPRL (<http://tiny.be>).
3+
# © 2015 Agile Business Group <http://www.agilebg.com>
4+
# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
5+
# License GPL-3.0 or later (http://www.gnu.org/licenses/gpl.html).
6+
7+
from . import models

auto_backup/__openerp__.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# -*- coding: utf-8 -*-
2+
# © 2004-2009 Tiny SPRL (<http://tiny.be>).
3+
# © 2015 Agile Business Group <http://www.agilebg.com>
4+
# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
5+
# License GPL-3.0 or later (http://www.gnu.org/licenses/gpl.html).
6+
7+
{
8+
"name": "Database Auto-Backup",
9+
"summary": "Backups database",
10+
"version": "9.0.1.0.0",
11+
"author": (
12+
"VanRoey.be - Yenthe Van Ginneken, Agile Business Group,"
13+
" Grupo ESOC Ingeniería de Servicios,"
14+
" Odoo Community Association (OCA)"
15+
),
16+
'license': "AGPL-3",
17+
"website": "http://www.vanroey.be/applications/bedrijfsbeheer/odoo",
18+
"category": "Tools",
19+
"depends": ['mail'],
20+
"data": [
21+
"data/ir_cron.xml",
22+
"data/mail_message_subtype.xml",
23+
"security/ir.model.access.csv",
24+
"view/db_backup_view.xml",
25+
],
26+
"application": True,
27+
"installable": True,
28+
"external_dependencies": {
29+
"python": ["pysftp"],
30+
},
31+
}

auto_backup/data/ir_cron.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<odoo noupdate="1">
4+
5+
<record id="ir_cron_backup_scheduler_0" model="ir.cron">
6+
<field name="name">Backup Scheduler</field>
7+
<field name="user_id" ref="base.user_root" />
8+
<field name="interval_number">1</field>
9+
<field name="interval_type">days</field>
10+
<field name="numbercall">-1</field>
11+
<field name="nextcall"
12+
eval="(datetime.now() + timedelta(days=1)).strftime('%Y-%m-%d 02:00:00')"
13+
/>
14+
<field name="model">db.backup</field>
15+
<field name="function">action_backup_all</field>
16+
</record>
17+
18+
</odoo>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<odoo noupdate="1">
4+
5+
<record id="mail_message_subtype_success" model="mail.message.subtype">
6+
<field name="name">Backup Successful</field>
7+
<field name="description">Database backup succeeded.</field>
8+
<field name="res_model">db.backup</field>
9+
<field name="default" eval="False" />
10+
</record>
11+
12+
<record id="mail_message_subtype_failure" model="mail.message.subtype">
13+
<field name="name">Backup Failed</field>
14+
<field name="description">Database backup failed.</field>
15+
<field name="res_model">db.backup</field>
16+
<field name="default" eval="True" />
17+
</record>
18+
19+
</odoo>

0 commit comments

Comments
 (0)