From 71607327777947ef3c18999501d2128f618c50f5 Mon Sep 17 00:00:00 2001
From: Yenthe
Date: Thu, 26 Mar 2015 15:35:50 +0100
Subject: [PATCH 01/74] Update english pot file
Added all the new fields and sentences. This will be the template for
translations.
---
auto_backup/i18n/auto_backup.pot | 141 +++++++++++++++++++++++++++++++
1 file changed, 141 insertions(+)
create mode 100644 auto_backup/i18n/auto_backup.pot
diff --git a/auto_backup/i18n/auto_backup.pot b/auto_backup/i18n/auto_backup.pot
new file mode 100644
index 00000000000..c560ff6eed9
--- /dev/null
+++ b/auto_backup/i18n/auto_backup.pot
@@ -0,0 +1,141 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * auto_backup
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 5.0.6\n"
+"Report-Msgid-Bugs-To: support@openerp.com\n"
+"POT-Creation-Date: 2009-11-24 13:49:51+0000\n"
+"PO-Revision-Date: 2009-11-24 13:49:51+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.model:0
+msgid "The Object name must start with x_ and not contain any special character !"
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.actions.act_window:0
+msgid "Invalid model name in the action definition."
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.model,name:auto_backup.model_db_backup
+msgid "db.backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "1) Go to Administration / Configuration / Scheduler / Scheduled Actions"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Test"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "IP Configuration"
+msgstr ""
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.module.module,shortdesc:auto_backup.module_meta_information
+msgid "Database Auto-Backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Database Configuration"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "4) Set other values as per your preference"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Automatic backup of all the databases under this can be scheduled as follows: "
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.ui.view:0
+msgid "Invalid XML for View Architecture!"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "2) Schedule new action(create a new record)"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.module.module,description:auto_backup.module_meta_information
+msgid "The generic Open ERP Database Auto-Backup system enables the user to make configurations for the automatic backup of the database.\n"
+"User simply requires to specify host & port under IP Configuration & database(on specified host running at specified port) and backup directory(in which all the backups of the specified database will be stored) under Database Configuration.\n"
+"\n"
+"Automatic backup for all such configured databases under this can then be scheduled as follows: \n"
+" \n"
+"1) Go to Administration / Configuration / Scheduler / Scheduled Actions\n"
+"2) Schedule new action(create a new record)\n"
+"3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under page 'Technical Data'\n"
+"4) Set other values as per your preference"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under page 'Technical Data'"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Help"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr ""
+
From 8c128230d3214e1177c0926b6c65c59c2f8aac8b Mon Sep 17 00:00:00 2001
From: Yenthe
Date: Thu, 26 Mar 2015 15:56:06 +0100
Subject: [PATCH 02/74] Dutch translations
Full translation of the module to Dutch
---
auto_backup/i18n/nl.po | 292 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 292 insertions(+)
create mode 100644 auto_backup/i18n/nl.po
diff --git a/auto_backup/i18n/nl.po b/auto_backup/i18n/nl.po
new file mode 100644
index 00000000000..8d739798b29
--- /dev/null
+++ b/auto_backup/i18n/nl.po
@@ -0,0 +1,292 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * auto_backup
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-03-26 14:17+0000\n"
+"PO-Revision-Date: 2015-03-26 14:17+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:137
+#, python-format
+msgid "%s"
+msgstr "%s"
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr "Absoluut pad om backups te bewaren"
+
+#. module: auto_backup
+#: field:db.backup,sendmailsftpfail:0
+msgid "Auto. E-mail on backup fail"
+msgstr "Auto. e-mailen wanneer backup mislukt"
+
+#. module: auto_backup
+#: field:db.backup,autoremove:0
+msgid "Auto. Remove Backups"
+msgstr "Auto. backups verwijderen"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Automatic backups of the database can be scheduled as follows:"
+msgstr "Automatische backups van de database kunnen als volgend gepland worden:"
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr "Backup folder"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_tree
+msgid "Backups"
+msgstr "Backups"
+
+#. module: auto_backup
+#: help:db.backup,daystokeepsftp:0
+msgid "Choose after how many days the backup should be deleted from the FTP server. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days from the FTP server."
+msgstr "Kies na hoeveel dagen de backups verwijderd moeten worden van de FTP server. Bijvoorbeeld:\n"
+"Als u 5 invult zal de backup na 5 dagen verwijderd worden van de FTP server."
+
+#. module: auto_backup
+#: help:db.backup,daystokeep:0
+msgid "Choose after how many days the backup should be deleted. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days."
+msgstr "Kies na hoeveel dagen de backup verwijderd moet worden. Bijvoorbeeld:\n"
+"Als u 5 invult zal de backup verwijderd worden na 5 dagen."
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr "Configureer backup"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Contact us!"
+msgstr "Contacteer ons!"
+
+#. module: auto_backup
+#: field:db.backup,create_uid:0
+msgid "Created by"
+msgstr "Gemaakt door"
+
+#. module: auto_backup
+#: field:db.backup,create_date:0
+msgid "Created on"
+msgstr "Gemaakt op"
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr "Database"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr "Database waar u backups voor wilt plannen"
+
+#. module: auto_backup
+#: field:db.backup,emailtonotify:0
+msgid "E-mail to notify"
+msgstr "E-mail om te verwittigen"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:106
+#: constraint:db.backup:0
+#, python-format
+msgid "Error ! No such database exists!"
+msgstr "Error! Deze database bestaat niet!"
+
+#. module: auto_backup
+#: help:db.backup,emailtonotify:0
+msgid "Fill in the e-mail where you want to be notified that the backup failed on the FTP."
+msgstr "Vul de e-mail in waarop u wilt verwittigd worden als de backup mislukt op de FTP."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "For example: /odoo/backups/"
+msgstr "Bijvoorbeeld: /odoo/backups/"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Go to Settings / Technical / Automation / Scheduled Actions."
+msgstr "Ga naar Instellingen / Technsich / Automatisering / Geplande acties"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Help"
+msgstr "Help"
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr "Host"
+
+#. module: auto_backup
+#: field:db.backup,id:0
+msgid "ID"
+msgstr "ID"
+
+#. module: auto_backup
+#: field:db.backup,sftpip:0
+msgid "IP Address SFTP Server"
+msgstr "IP adres SFTP server"
+
+#. module: auto_backup
+#: help:db.backup,sendmailsftpfail:0
+msgid "If you check this option you can choose to automaticly get e-mailed when the backup to the external server failed."
+msgstr "Als u deze optie aanvinkt kan u kiezen om automatisch een e-mail aan te krijgen als de backup
+naar de externe server mislukt."
+
+#. module: auto_backup
+#: help:db.backup,autoremove:0
+msgid "If you check this option you can choose to automaticly remove the backup after xx days"
+msgstr "Als u deze optie aanvinkt kan u kiezen om automatisch backups te verwijderen na xx dagen"
+
+#. module: auto_backup
+#: help:db.backup,sftpwrite:0
+msgid "If you check this option you can specify the details needed to write to a remote server with SFTP."
+msgstr "Als u deze optie aanvinkt kan u de details invullen die nodig zijn om te connecteren met de externe SFTP server."
+
+#. module: auto_backup
+#: field:db.backup,write_uid:0
+msgid "Last Updated by"
+msgstr "Laatst bijgewerkt door"
+
+#. module: auto_backup
+#: field:db.backup,write_date:0
+msgid "Last Updated on"
+msgstr "Laatst bijgewerkt op"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Local backup configuration"
+msgstr "Lokale backup configuratie"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Need more help?"
+msgstr "Meer hulp nodig?"
+
+#. module: auto_backup
+#: field:db.backup,sftppassword:0
+msgid "Password User SFTP Server"
+msgstr "Wachtwoord gebruiker SFTP server"
+
+#. module: auto_backup
+#: field:db.backup,sftppath:0
+msgid "Path external server"
+msgstr "Pad externe server"
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr "Poort"
+
+#. module: auto_backup
+#: field:db.backup,daystokeepsftp:0
+msgid "Remove SFTP after x days"
+msgstr "SFTP verwijderen na x dagen"
+
+#. module: auto_backup
+#: field:db.backup,daystokeep:0
+msgid "Remove after x days"
+msgstr "Verwijderen na x dagen"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "SFTP"
+msgstr "SFTP"
+
+#. module: auto_backup
+#: field:db.backup,sftpport:0
+msgid "SFTP Port"
+msgstr "SFTP poort"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_search
+msgid "Search options"
+msgstr "Zoekopties"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Search the action named 'Backup scheduler'."
+msgstr "Zoek de actie genaamd 'Backup scheduler'."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Set the scheduler to active and fill in how often you want backups generated."
+msgstr "Zet de planner op actief en vul in hoe vaak de backup moet gemaakt worden."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test"
+msgstr "Test"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test SFTP Connection"
+msgstr "Test SFTP Connectie"
+
+#. module: auto_backup
+#: help:db.backup,sftpip:0
+msgid "The IP address from your remote server. For example 192.168.0.1"
+msgstr "Het IP adres van uw externe server. Bijvoorbeeld: 192.168.0.1"
+
+#. module: auto_backup
+#: help:db.backup,sftppath:0
+msgid "The location to the folder where the dumps should be written to. For example /odoo/backups/.\n"
+"Files will then be written to /odoo/backups/ on your remote server."
+msgstr "De locatie naar de folder waar de backup naar toe moet geschreven worden. Bijvoorbeeld odoo/backups/\n"
+"Bestanden worden dan naar /odoo/backups/ geschreven op de externe server"
+
+#. module: auto_backup
+#: help:db.backup,sftppassword:0
+msgid "The password from the user where the SFTP connection should be made with. This is the password from the user on the external server."
+msgstr "Het wachtwoord van de gebruiker waar de SFTP connectie mee moet gemaakt worden. Dit is het wachtwoord van de gebruiker op de externe server."
+
+#. module: auto_backup
+#: help:db.backup,sftpport:0
+msgid "The port on the FTP server that accepts SSH/SFTP calls."
+msgstr "De poort op de FTP server die SSH/SFTP accepteert."
+
+#. module: auto_backup
+#: help:db.backup,sftpusername:0
+msgid "The username where the SFTP connection should be made with. This is the user on the external server."
+msgstr "De gebruikersnaam waar de SFTP connectie mee gemaakt moet worden. Dit is de gebruiker op de externe server."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
+msgstr "Dit configureert de planner voor automatische backups op de ingegeven database waar de host, poort en database op zijn ingegeven voor reguliere intervallen."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Use SFTP with caution! This writes files to external servers under the path you specify."
+msgstr "Gebruik SFTP voorzichtig! Dit schrijft bestanden naar externe servers onder het pad dat u opgeeft."
+
+#. module: auto_backup
+#: field:db.backup,sftpusername:0
+msgid "Username SFTP Server"
+msgstr "Gebruikersnaam SFTP Server"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Warning:"
+msgstr "Waarschuwing:"
+
+#. module: auto_backup
+#: field:db.backup,sftpwrite:0
+msgid "Write to external server with sftp"
+msgstr "Schrijf naar externe server met SFTP"
From e1eb1afef0565dfb5546a5fcef5f5a41d9fddc56 Mon Sep 17 00:00:00 2001
From: Yenthe
Date: Fri, 27 Mar 2015 08:13:21 +0100
Subject: [PATCH 03/74] Chinese translations
Add Chinese translations to the module. Written by talway.
---
auto_backup/i18n/zh_CN.po | 298 ++++++++++++++++++++++++++++++++++++++
1 file changed, 298 insertions(+)
create mode 100644 auto_backup/i18n/zh_CN.po
diff --git a/auto_backup/i18n/zh_CN.po b/auto_backup/i18n/zh_CN.po
new file mode 100644
index 00000000000..352a1e6749c
--- /dev/null
+++ b/auto_backup/i18n/zh_CN.po
@@ -0,0 +1,298 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * auto_backup
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-03-26 14:17+0000\n"
+"PO-Revision-Date: 2015-03-27 00:16+0800\n"
+"Last-Translator: <>\n"
+"Language-Team: Talway <1473162392@qq.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"Language: zh_CN\n"
+"X-Generator: Poedit 1.7.5\n"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:137
+#, python-format
+msgid "%s"
+msgstr "%s"
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr "备份据对路径"
+
+#. module: auto_backup
+#: field:db.backup,sendmailsftpfail:0
+msgid "Auto. E-mail on backup fail"
+msgstr "自动。电子邮件备份失败"
+
+#. module: auto_backup
+#: field:db.backup,autoremove:0
+msgid "Auto. Remove Backups"
+msgstr "自动 删除备份"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Automatic backups of the database can be scheduled as follows:"
+msgstr "数据库的自动备份时间安排如下:"
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr "备份目录"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_tree
+msgid "Backups"
+msgstr "备份"
+
+#. module: auto_backup
+#: help:db.backup,daystokeepsftp:0
+msgid ""
+"Choose after how many days the backup should be deleted from the FTP server. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days from the FTP server."
+msgstr ""
+"选择后多少天备份应被删除从 FTP 服务器。例如: \n"
+"如果你填写 5, 将5 天后 从FTP 服务器 删除备份文件。"
+
+#. module: auto_backup
+#: help:db.backup,daystokeep:0
+msgid ""
+"Choose after how many days the backup should be deleted. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days."
+msgstr ""
+"选择后多少天备份应被删除。例如: \n"
+"如果 你填写 5 ,将 5 天后删除备份。"
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr "数据库备份"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Contact us!"
+msgstr "联系我们!"
+
+#. module: auto_backup
+#: field:db.backup,create_uid:0
+msgid "Created by"
+msgstr "创建者"
+
+#. module: auto_backup
+#: field:db.backup,create_date:0
+msgid "Created on"
+msgstr "创建时间"
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr "数据库"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr "计划备份的数据库"
+
+#. module: auto_backup
+#: field:db.backup,emailtonotify:0
+msgid "E-mail to notify"
+msgstr "邮件通知"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:106 constraint:db.backup:0
+#, python-format
+msgid "Error ! No such database exists!"
+msgstr "错误 !这个数据库不存在 !"
+
+#. module: auto_backup
+#: help:db.backup,emailtonotify:0
+msgid "Fill in the e-mail where you want to be notified that the backup failed on the FTP."
+msgstr "FTP备份失败时,邮件通知你详细信息"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "For example: /odoo/backups/"
+msgstr "例如: /odoo/backups/"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Go to Settings / Technical / Automation / Scheduled Actions."
+msgstr "点击 设置 / 技术 / 自动化 / 计划的动作"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Help"
+msgstr "帮助"
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr "服务器"
+
+#. module: auto_backup
+#: field:db.backup,id:0
+msgid "ID"
+msgstr "ID"
+
+#. module: auto_backup
+#: field:db.backup,sftpip:0
+msgid "IP Address SFTP Server"
+msgstr " SFTP 服务器 IP 地址"
+
+#. module: auto_backup
+#: help:db.backup,sendmailsftpfail:0
+msgid "If you check this option you can choose to automaticly get e-mailed when the backup to the external server failed."
+msgstr "如果您选中此选项,您可以选择自动收到通过邮件发送到外部服务器备份失败的信息。"
+
+#. module: auto_backup
+#: help:db.backup,autoremove:0
+msgid "If you check this option you can choose to automaticly remove the backup after xx days"
+msgstr "如果您选中此选项,您可以选择 xx 天后自动删除备份"
+
+#. module: auto_backup
+#: help:db.backup,sftpwrite:0
+msgid "If you check this option you can specify the details needed to write to a remote server with SFTP."
+msgstr "如果您选中此选项,您可以指定需要写入 sftp 的远程服务器的详细信息。"
+
+#. module: auto_backup
+#: field:db.backup,write_uid:0
+msgid "Last Updated by"
+msgstr "最后更新者"
+
+#. module: auto_backup
+#: field:db.backup,write_date:0
+msgid "Last Updated on"
+msgstr "上次更新日期"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Local backup configuration"
+msgstr "本地备份配置"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Need more help?"
+msgstr "需要更多帮助吗?"
+
+#. module: auto_backup
+#: field:db.backup,sftppassword:0
+msgid "Password User SFTP Server"
+msgstr " SFTP服务器密码"
+
+#. module: auto_backup
+#: field:db.backup,sftppath:0
+msgid "Path external server"
+msgstr "服务器目录"
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr "端口"
+
+#. module: auto_backup
+#: field:db.backup,daystokeepsftp:0
+msgid "Remove SFTP after x days"
+msgstr "多少天后从服务器删除"
+
+#. module: auto_backup
+#: field:db.backup,daystokeep:0
+msgid "Remove after x days"
+msgstr "多少天后删除"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "SFTP"
+msgstr "SFTP"
+
+#. module: auto_backup
+#: field:db.backup,sftpport:0
+msgid "SFTP Port"
+msgstr "SFTP 端口"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_search
+msgid "Search options"
+msgstr "搜索选项"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Search the action named 'Backup scheduler'."
+msgstr "搜索计划备份调度程序“Backup scheduler”。"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Set the scheduler to active and fill in how often you want backups generated."
+msgstr "设置计划动作为有效,并填写备份间隔时间,间隔时间单位,间隔次数,执行时间等数据库具体备份方案。"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test"
+msgstr "测试"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test SFTP Connection"
+msgstr "测试 SFTP 连接"
+
+#. module: auto_backup
+#: help:db.backup,sftpip:0
+msgid "The IP address from your remote server. For example 192.168.0.1"
+msgstr "远程服务器的 IP 地址。例如: 192.168.0.1"
+
+#. module: auto_backup
+#: help:db.backup,sftppath:0
+msgid ""
+"The location to the folder where the dumps should be written to. For example /odoo/backups/.\n"
+"Files will then be written to /odoo/backups/ on your remote server."
+msgstr ""
+"转储应将写入的文件夹位置。例如 /odoo/backups/远程服务器上,然后将写入 /odoo/backups/.\n"
+"Files。"
+
+#. module: auto_backup
+#: help:db.backup,sftppassword:0
+msgid "The password from the user where the SFTP connection should be made with. This is the password from the user on the external server."
+msgstr "从 SFTP 服务器连接该用户的密码。这是SFTP服务器上的用户密码。"
+
+#. module: auto_backup
+#: help:db.backup,sftpport:0
+msgid "The port on the FTP server that accepts SSH/SFTP calls."
+msgstr "接受 SSH/SFTP 使用的FTP 服务器上的端口。"
+
+#. module: auto_backup
+#: help:db.backup,sftpusername:0
+msgid "The username where the SFTP connection should be made with. This is the user on the external server."
+msgstr "SFTP 连接使用该用户名。这是在SFTP服务器上的用户。"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
+msgstr "配置适用指定数据库备份 在设置服务器端口定期运行"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Use SFTP with caution! This writes files to external servers under the path you specify."
+msgstr "请注意你的 SFTP服务器网络安全!数据库备份文件将备份到你的SFTP服务器,文件保存在设置的目录下面。"
+
+#. module: auto_backup
+#: field:db.backup,sftpusername:0
+msgid "Username SFTP Server"
+msgstr "SFTP 服务器 用户名"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Warning:"
+msgstr "警告:"
+
+#. module: auto_backup
+#: field:db.backup,sftpwrite:0
+msgid "Write to external server with sftp"
+msgstr "备份到外部 sftp 服务器"
From 769c85c1da98cf5d90388e7d130c1ceb19561a79 Mon Sep 17 00:00:00 2001
From: Yenthe
Date: Fri, 27 Mar 2015 13:21:14 +0100
Subject: [PATCH 04/74] Changes chinese translation
Changed some translations
---
auto_backup/i18n/zh_CN.po | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/auto_backup/i18n/zh_CN.po b/auto_backup/i18n/zh_CN.po
index 352a1e6749c..8178604fc1f 100644
--- a/auto_backup/i18n/zh_CN.po
+++ b/auto_backup/i18n/zh_CN.po
@@ -26,17 +26,17 @@ msgstr "%s"
#. module: auto_backup
#: help:db.backup,bkp_dir:0
msgid "Absolute path for storing the backups"
-msgstr "备份据对路径"
+msgstr "备份绝对路径"
#. module: auto_backup
#: field:db.backup,sendmailsftpfail:0
msgid "Auto. E-mail on backup fail"
-msgstr "自动。电子邮件备份失败"
+msgstr "FTP备份失败自动邮件通知你"
#. module: auto_backup
#: field:db.backup,autoremove:0
msgid "Auto. Remove Backups"
-msgstr "自动 删除备份"
+msgstr "自动删除备份"
#. module: auto_backup
#: view:db.backup:auto_backup.view_backup_conf_form
@@ -69,7 +69,7 @@ msgid ""
"If you fill in 5 the backups will be removed after 5 days."
msgstr ""
"选择后多少天备份应被删除。例如: \n"
-"如果 你填写 5 ,将 5 天后删除备份。"
+"如果你填写5,将 5 天后删除备份。"
#. module: auto_backup
#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
@@ -80,7 +80,7 @@ msgstr "数据库备份"
#. module: auto_backup
#: view:db.backup:auto_backup.view_backup_conf_form
msgid "Contact us!"
-msgstr "联系我们!"
+msgstr "邮件联系我们!"
#. module: auto_backup
#: field:db.backup,create_uid:0
@@ -105,7 +105,7 @@ msgstr "计划备份的数据库"
#. module: auto_backup
#: field:db.backup,emailtonotify:0
msgid "E-mail to notify"
-msgstr "邮件通知"
+msgstr "E-mail邮件地址"
#. module: auto_backup
#: code:addons/auto_backup/backup_scheduler.py:106 constraint:db.backup:0
@@ -246,7 +246,7 @@ msgstr "测试 SFTP 连接"
#. module: auto_backup
#: help:db.backup,sftpip:0
msgid "The IP address from your remote server. For example 192.168.0.1"
-msgstr "远程服务器的 IP 地址。例如: 192.168.0.1"
+msgstr "SFTP服务器的 IP 地址。例如: 192.168.0.1"
#. module: auto_backup
#: help:db.backup,sftppath:0
@@ -285,7 +285,7 @@ msgstr "请注意你的 SFTP服务器网络安全!数据库备份文件将备
#. module: auto_backup
#: field:db.backup,sftpusername:0
msgid "Username SFTP Server"
-msgstr "SFTP 服务器 用户名"
+msgstr "SFTP服务器用户名"
#. module: auto_backup
#: view:db.backup:auto_backup.view_backup_conf_form
From 656800f7f404a85581440d7c009ef3ac9bf6215b Mon Sep 17 00:00:00 2001
From: Yenthe
Date: Mon, 20 Apr 2015 09:27:04 +0200
Subject: [PATCH 05/74] Full German translations
Thanks to Martin Schmid!
---
auto_backup/i18n/de.po | 299 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 299 insertions(+)
create mode 100644 auto_backup/i18n/de.po
diff --git a/auto_backup/i18n/de.po b/auto_backup/i18n/de.po
new file mode 100644
index 00000000000..7320d2875e4
--- /dev/null
+++ b/auto_backup/i18n/de.po
@@ -0,0 +1,299 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * auto_backup
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-03-26 14:17+0000\n"
+"PO-Revision-Date: 2015-04-17 11:24+0100\n"
+"Last-Translator: Martin Schmid \n"
+"Language-Team: Equitania Software GmbH \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 1.7.5\n"
+"Language: de\n"
+"X-Poedit-SourceCharset: UTF-8\n"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:137
+#, python-format
+msgid "%s"
+msgstr "%s"
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr "Absoluter Pfad zum Speichern der Sicherungen"
+
+#. module: auto_backup
+#: field:db.backup,sendmailsftpfail:0
+msgid "Auto. E-mail on backup fail"
+msgstr "Auto. E-Mail, wenn Datensicherung fehlschlägt"
+
+#. module: auto_backup
+#: field:db.backup,autoremove:0
+msgid "Auto. Remove Backups"
+msgstr "Auto. Entfernen von Sicherungen"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Automatic backups of the database can be scheduled as follows:"
+msgstr "Automatische Sicherungen der Datenbank können wie folgt geplant werden:"
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr "Sicherungs-Verzeichnis"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_tree
+msgid "Backups"
+msgstr "Sicherungen"
+
+#. module: auto_backup
+#: help:db.backup,daystokeepsftp:0
+msgid ""
+"Choose after how many days the backup should be deleted from the FTP server. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days from the FTP server."
+msgstr ""
+"Wählen Sie, nach wie vielen Tagen die Sicherung vom FTP-Server gelöscht werden soll. Beispiel: \n"
+"Wenn Sie \"5\" angeben, werden die Sicherungen nach 5 Tagen vom FTP-Server entfernt."
+
+#. module: auto_backup
+#: help:db.backup,daystokeep:0
+msgid ""
+"Choose after how many days the backup should be deleted. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days."
+msgstr ""
+"Wählen Sie, nach wie vielen Tagen die Sicherung vom FTP-Server gelöscht werden soll. Beispiel: \n"
+"Wenn Sie \"5\" angeben, werden die Sicherungen nach 5 Tagen vom FTP-Server entfernt."
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr "Backup einstellen"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Contact us!"
+msgstr "Sprechen Sie uns an!"
+
+#. module: auto_backup
+#: field:db.backup,create_uid:0
+msgid "Created by"
+msgstr "Erstellt von"
+
+#. module: auto_backup
+#: field:db.backup,create_date:0
+msgid "Created on"
+msgstr "Erstellt am:"
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr "Datenbank"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr "Datenbank Sicherungen einplanen für"
+
+#. module: auto_backup
+#: field:db.backup,emailtonotify:0
+msgid "E-mail to notify"
+msgstr "E-Mail Benachrichtigen"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:106 constraint:db.backup:0
+#, python-format
+msgid "Error ! No such database exists!"
+msgstr "Fehler! Keine solche Datenbank vorhanden!"
+
+#. module: auto_backup
+#: help:db.backup,emailtonotify:0
+msgid "Fill in the e-mail where you want to be notified that the backup failed on the FTP."
+msgstr "Geben Sie die E-Mail-Adresse an, die bei Sicherungsfehlern auf dem FTP verwendet werden soll."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "For example: /odoo/backups/"
+msgstr "Zum Beispiel: /odoo/Backups /"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Go to Settings / Technical / Automation / Scheduled Actions."
+msgstr "Gehen Sie zu Einstellungen / Technisch / Automation / Geplante Vorgänge"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Help"
+msgstr "Hilfe"
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr "Host"
+
+#. module: auto_backup
+#: field:db.backup,id:0
+msgid "ID"
+msgstr "ID"
+
+#. module: auto_backup
+#: field:db.backup,sftpip:0
+msgid "IP Address SFTP Server"
+msgstr "IP-Adresse SFTP-Server"
+
+#. module: auto_backup
+#: help:db.backup,sendmailsftpfail:0
+msgid "If you check this option you can choose to automaticly get e-mailed when the backup to the external server failed."
+msgstr "Wenn Sie diese Option aktivieren, erhalten Sie automatisch eine e-Mail, wenn die Sicherung mit dem externen Server fehlgeschlagen ist."
+
+#. module: auto_backup
+#: help:db.backup,autoremove:0
+msgid "If you check this option you can choose to automaticly remove the backup after xx days"
+msgstr "Wenn Sie diese Option aktivieren, können Sie die Sicherung automatisch nach Xx Tagen entfernen"
+
+#. module: auto_backup
+#: help:db.backup,sftpwrite:0
+msgid "If you check this option you can specify the details needed to write to a remote server with SFTP."
+msgstr "Wenn Sie diese Option aktivieren, können Sie Details für einen entfernten SFTP-Server angeben."
+
+#. module: auto_backup
+#: field:db.backup,write_uid:0
+msgid "Last Updated by"
+msgstr "Zuletzt aktualisiert von"
+
+#. module: auto_backup
+#: field:db.backup,write_date:0
+msgid "Last Updated on"
+msgstr "Zuletzt aktualisiert am"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Local backup configuration"
+msgstr "Lokale Sicherungs-Konfiguration"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Need more help?"
+msgstr "Benötigen Sie weitere Hilfe?"
+
+#. module: auto_backup
+#: field:db.backup,sftppassword:0
+msgid "Password User SFTP Server"
+msgstr "Passwort Benutzer SFTP-Server"
+
+#. module: auto_backup
+#: field:db.backup,sftppath:0
+msgid "Path external server"
+msgstr "Externen Server Pfad"
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr "Port"
+
+#. module: auto_backup
+#: field:db.backup,daystokeepsftp:0
+msgid "Remove SFTP after x days"
+msgstr "SFTP nach x Tagen entfernen"
+
+#. module: auto_backup
+#: field:db.backup,daystokeep:0
+msgid "Remove after x days"
+msgstr "Entfernen nach x Tagen"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "SFTP"
+msgstr "SFTP"
+
+#. module: auto_backup
+#: field:db.backup,sftpport:0
+msgid "SFTP Port"
+msgstr "SFTP-Port"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_search
+msgid "Search options"
+msgstr "Suchkriterien"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Search the action named 'Backup scheduler'."
+msgstr "Suchen Sie die Aktion mit dem Namen \"Backup Scheduler\"."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Set the scheduler to active and fill in how often you want backups generated."
+msgstr "Setzen Sie die Aktion auf aktiv und geben Sie an wie oft die Sicherungen erstellt werden soll."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test"
+msgstr "Test"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test SFTP Connection"
+msgstr "Verbindung testen"
+
+#. module: auto_backup
+#: help:db.backup,sftpip:0
+msgid "The IP address from your remote server. For example 192.168.0.1"
+msgstr "Die IP-Adresse Ihres entfernten Servers. Zum Beispiel 192.168.0.1"
+
+#. module: auto_backup
+#: help:db.backup,sftppath:0
+msgid ""
+"The location to the folder where the dumps should be written to. For example /odoo/backups/.\n"
+"Files will then be written to /odoo/backups/ on your remote server."
+msgstr ""
+"Der Speicherort für den Ordner an dem die Sicherungen in gespeichert werden sollen. Zum Beispiel wird /odoo/backups/.\n"
+"Files geschrieben zu /odoo/backups / / auf dem remote Server."
+
+#. module: auto_backup
+#: help:db.backup,sftppassword:0
+msgid "The password from the user where the SFTP connection should be made with. This is the password from the user on the external server."
+msgstr "Das Kennwort des Benutzers mit dem die SFTP-Verbindung mit hergestellt werden soll. Dies ist das Kennwort des Benutzers auf dem externen Server."
+
+#. module: auto_backup
+#: help:db.backup,sftpport:0
+msgid "The port on the FTP server that accepts SSH/SFTP calls."
+msgstr "Der Port auf dem FTP-Server, der SSH/SFTP Anfragen annimmt."
+
+#. module: auto_backup
+#: help:db.backup,sftpusername:0
+msgid "The username where the SFTP connection should be made with. This is the user on the external server."
+msgstr "Der Benutzername mit dem die SFTP-Verbindung mit hergestellt werden soll. Dies ist der Benutzer auf dem externen Server."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
+msgstr "Dies ist Konfiguration der Aktion automatisierte Backups der Datenbank auf dem angegebenen Server durchzuführen."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Use SFTP with caution! This writes files to external servers under the path you specify."
+msgstr "Verwenden Sie SFTP mit Vorsicht! Dies schreibt Dateien auf externen Servern unter dem Pfad, den Sie angeben."
+
+#. module: auto_backup
+#: field:db.backup,sftpusername:0
+msgid "Username SFTP Server"
+msgstr "Benutzername SFTP-Server"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Warning:"
+msgstr "Warnung:"
+
+#. module: auto_backup
+#: field:db.backup,sftpwrite:0
+msgid "Write to external server with sftp"
+msgstr "Auf externen Server mit SFTP schreiben"
From f65eb61704daad6c8a98c46c8ea03a602ed59963 Mon Sep 17 00:00:00 2001
From: Yenthe
Date: Thu, 7 May 2015 15:54:08 +0200
Subject: [PATCH 06/74] Typo fix
could'nt > couldn't
---
auto_backup/backup_scheduler.py | 267 ++++++++++++++++++++++++++++++++
1 file changed, 267 insertions(+)
create mode 100644 auto_backup/backup_scheduler.py
diff --git a/auto_backup/backup_scheduler.py b/auto_backup/backup_scheduler.py
new file mode 100644
index 00000000000..6ec77a90318
--- /dev/null
+++ b/auto_backup/backup_scheduler.py
@@ -0,0 +1,267 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# 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 .
+#
+##############################################################################
+
+import xmlrpclib
+import socket
+import os
+import time
+import datetime
+import base64
+import re
+try:
+ import pysftp
+except ImportError:
+ raise ImportError('This module needs pysftp to automaticly write backups to the FTP through SFTP.Please install pysftp on your system.(sudo pip install pysftp)')
+from openerp.osv import fields,osv,orm
+from openerp import tools
+from openerp import netsvc
+from openerp import tools, _
+import logging
+_logger = logging.getLogger(__name__)
+
+def execute(connector, method, *args):
+ res = False
+ try:
+ res = getattr(connector,method)(*args)
+ except socket.error,e:
+ raise e
+ return res
+
+addons_path = tools.config['addons_path'] + '/auto_backup/DBbackups'
+
+class db_backup(osv.Model):
+ _name = 'db.backup'
+
+ def get_db_list(self, cr, user, ids, host, port, context={}):
+ print("Host: " + host)
+ print("Port: " + port)
+ uri = 'http://' + host + ':' + port
+ conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/db')
+ db_list = execute(conn, 'list')
+ return db_list
+
+ def _get_db_name(self,cr,uid, vals,context=None):
+ attach_pool = self.pool.get("ir.logging")
+ dbName = cr.dbname
+ return dbName
+
+ _columns = {
+ #Columns local server
+ 'host' : fields.char('Host', size=100, required='True'),
+ 'port' : fields.char('Port', size=10, required='True'),
+ 'name' : fields.char('Database', size=100, required='True',help='Database you want to schedule backups for'),
+ 'bkp_dir' : fields.char('Backup Directory', size=100, help='Absolute path for storing the backups', required='True'),
+ 'autoremove': fields.boolean('Auto. Remove Backups', help="If you check this option you can choose to automaticly remove the backup after xx days"),
+ 'daystokeep': fields.integer('Remove after x days',
+ help="Choose after how many days the backup should be deleted. For example:\nIf you fill in 5 the backups will be removed after 5 days.",required=True),
+ #Columns for external server (SFTP)
+ 'sftpwrite': fields.boolean('Write to external server with sftp', help="If you check this option you can specify the details needed to write to a remote server with SFTP."),
+ 'sftppath': fields.char('Path external server', help="The location to the folder where the dumps should be written to. For example /odoo/backups/.\nFiles will then be written to /odoo/backups/ on your remote server."),
+ 'sftpip': fields.char('IP Address SFTP Server', help="The IP address from your remote server. For example 192.168.0.1"),
+ 'sftpport': fields.integer("SFTP Port", help="The port on the FTP server that accepts SSH/SFTP calls."),
+ 'sftpusername': fields.char('Username SFTP Server', help="The username where the SFTP connection should be made with. This is the user on the external server."),
+ 'sftppassword': fields.char('Password User SFTP Server', help="The password from the user where the SFTP connection should be made with. This is the password from the user on the external server."),
+ 'daystokeepsftp': fields.integer('Remove SFTP after x days', help="Choose after how many days the backup should be deleted from the FTP server. For example:\nIf you fill in 5 the backups will be removed after 5 days from the FTP server."),
+ 'sendmailsftpfail': fields.boolean('Auto. E-mail on backup fail', help="If you check this option you can choose to automaticly get e-mailed when the backup to the external server failed."),
+ 'emailtonotify': fields.char('E-mail to notify', help="Fill in the e-mail where you want to be notified that the backup failed on the FTP."),
+ }
+
+ _defaults = {
+ #'bkp_dir' : lambda *a : addons_path,
+ 'bkp_dir' : '/odoo/backups',
+ 'host' : lambda *a : 'localhost',
+ 'port' : lambda *a : '8069',
+ 'name': _get_db_name,
+ 'daystokeepsftp': 30,
+ 'sftpport': 22,
+ }
+
+ def _check_db_exist(self, cr, user, ids):
+ for rec in self.browse(cr,user,ids):
+ db_list = self.get_db_list(cr, user, ids, rec.host, rec.port)
+ if rec.name in db_list:
+ return True
+ return False
+
+ _constraints = [
+ (_check_db_exist, _('Error ! No such database exists!'), [])
+ ]
+
+
+ def test_sftp_connection(self, cr, uid, ids, context=None):
+ conf_ids= self.search(cr, uid, [])
+ confs = self.browse(cr,uid,conf_ids)
+ #Check if there is a success or fail and write messages
+ messageTitle = ""
+ messageContent = ""
+ for rec in confs:
+ db_list = self.get_db_list(cr, uid, [], rec.host, rec.port)
+ try:
+ pathToWriteTo = rec.sftppath
+ ipHost = rec.sftpip
+ portHost = rec.sftpport
+ usernameLogin = rec.sftpusername
+ passwordLogin = rec.sftppassword
+ #Connect with external server over SFTP, so we know sure that everything works.
+ srv = pysftp.Connection(host=ipHost, username=usernameLogin,
+password=passwordLogin,port=portHost)
+ srv.close()
+ #We have a success.
+ messageTitle = "Connection Test Succeeded!"
+ messageContent = "Everything seems properly set up for FTP back-ups!"
+ except Exception, e:
+ messageTitle = "Connection Test Failed!"
+ if len(rec.sftpip) < 8:
+ messageContent += "\nYour IP address seems to be too short.\n"
+ messageContent += "Here is what we got instead:\n"
+ if "Failed" in messageTitle:
+ raise osv.except_osv(_(messageTitle), _(messageContent + "%s") % tools.ustr(e))
+ else:
+ raise osv.except_osv(_(messageTitle), _(messageContent))
+
+ def schedule_backup(self, cr, user, context={}):
+ conf_ids= self.search(cr, user, [])
+ confs = self.browse(cr,user,conf_ids)
+ for rec in confs:
+ db_list = self.get_db_list(cr, user, [], rec.host, rec.port)
+ if rec.name in db_list:
+ try:
+ if not os.path.isdir(rec.bkp_dir):
+ os.makedirs(rec.bkp_dir)
+ except:
+ raise
+ #Create name for dumpfile.
+ bkp_file='%s_%s.dump' % (time.strftime('%d_%m_%Y_%H_%M_%S'),rec.name)
+ file_path = os.path.join(rec.bkp_dir,bkp_file)
+ fp = open(file_path,'wb')
+ uri = 'http://' + rec.host + ':' + rec.port
+ conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/db')
+ bkp=''
+ try:
+ bkp = execute(conn, 'dump', tools.config['admin_passwd'], rec.name)
+ except:
+ logger.notifyChannel('backup', netsvc.LOG_INFO, "Could'nt backup database %s. Bad database administrator password for server running at http://%s:%s" %(rec.name, rec.host, rec.port))
+ continue
+ bkp = base64.decodestring(bkp)
+ fp.write(bkp)
+ fp.close()
+ else:
+ logger.notifyChannel('backup', netsvc.LOG_INFO, "database %s doesn't exist on http://%s:%s" %(rec.name, rec.host, rec.port))
+
+ #Check if user wants to write to SFTP or not.
+ if rec.sftpwrite is True:
+ try:
+ #Store all values in variables
+ dir = rec.bkp_dir
+ pathToWriteTo = rec.sftppath
+ ipHost = rec.sftpip
+ portHost = rec.sftpport
+ usernameLogin = rec.sftpusername
+ passwordLogin = rec.sftppassword
+ #Connect with external server over SFTP
+ srv = pysftp.Connection(host=ipHost, username=usernameLogin,
+password=passwordLogin, port=portHost)
+ #Move to the correct directory on external server. If the user made a typo in his path with multiple slashes (/odoo//backups/) it will be fixed by this regex.
+ pathToWriteTo = re.sub('([/]{2,5})+','/',pathToWriteTo)
+ print(pathToWriteTo)
+ try:
+ srv.chdir(pathToWriteTo)
+ except IOError:
+ #Create directory and subdirs if they do not exist.
+ currentDir = ''
+ for dirElement in pathToWriteTo.split('/'):
+ currentDir += dirElement + '/'
+ try:
+ srv.chdir(currentDir)
+ except:
+ print('(Part of the) path didn\'t exist. Creating it now at ' + currentDir)
+ #Make directory and then navigate into it
+ srv.mkdir(currentDir, mode=777)
+ srv.chdir(currentDir)
+ pass
+ srv.chdir(pathToWriteTo)
+ #Loop over all files in the directory.
+ for f in os.listdir(dir):
+ fullpath = os.path.join(dir, f)
+ if os.path.isfile(fullpath):
+ print(fullpath)
+ srv.put(fullpath)
+
+ #Navigate in to the correct folder.
+ srv.chdir(pathToWriteTo)
+
+ #Loop over all files in the directory from the back-ups.
+ #We will check the creation date of every back-up.
+ for file in srv.listdir(pathToWriteTo):
+ #Get the full path
+ fullpath = os.path.join(pathToWriteTo,file)
+ #Get the timestamp from the file on the external server
+ timestamp = srv.stat(fullpath).st_atime
+ createtime = datetime.datetime.fromtimestamp(timestamp)
+ now = datetime.datetime.now()
+ delta = now - createtime
+ #If the file is older than the daystokeepsftp (the days to keep that the user filled in on the Odoo form it will be removed.
+ if delta.days >= rec.daystokeepsftp:
+ #Only delete files, no directories!
+ if srv.isfile(fullpath) and ".dump" in file:
+ print("Delete: " + file)
+ srv.unlink(file)
+ #Close the SFTP session.
+ srv.close()
+ except Exception, e:
+ _logger.debug('Exception! We couldn\'t back up to the FTP server..')
+ #At this point the SFTP backup failed. We will now check if the user wants
+ #an e-mail notification about this.
+ if rec.sendmailsftpfail:
+ try:
+ ir_mail_server = self.pool.get('ir.mail_server')
+ message = "Dear,\n\nThe backup for the server " + rec.host + " (IP: " + rec.sftpip + ") failed.Please check the following details:\n\nIP address SFTP server: " + rec.sftpip + "\nUsername: " + rec.sftpusername + "\nPassword: " + rec.sftppassword + "\n\nError details: " + tools.ustr(e) + "\n\nWith kind regards"
+ msg = ir_mail_server.build_email("auto_backup@" + rec.name + ".com", [rec.emailtonotify], "Backup from " + rec.host + "(" + rec.sftpip + ") failed", message)
+ ir_mail_server.send_email(cr, user, msg)
+ except Exception:
+ pass
+
+ """Remove all old files (on local server) in case this is configured..
+ This is done after the SFTP writing to prevent unusual behaviour:
+ If the user would set local back-ups to be kept 0 days and the SFTP
+ to keep backups xx days there wouldn't be any new back-ups added to the
+ SFTP.
+ If we'd remove the dump files before they're writen to the SFTP there willbe nothing to write. Meaning that if an user doesn't want to keep back-ups locally and only wants them on the SFTP (NAS for example) there wouldn't be any writing to the remote server if this if statement was before the SFTP write method right above this comment.
+ """
+ if rec.autoremove is True:
+ dir = rec.bkp_dir
+ #Loop over all files in the directory.
+ for f in os.listdir(dir):
+ fullpath = os.path.join(dir, f)
+ timestamp = os.stat(fullpath).st_ctime
+ createtime = datetime.datetime.fromtimestamp(timestamp)
+ now = datetime.datetime.now()
+ delta = now - createtime
+ if delta.days >= rec.daystokeep:
+ #Only delete files (which are .dump), no directories.
+ if os.path.isfile(fullpath) and ".dump" in f:
+ print("Delete: " + fullpath)
+ os.remove(fullpath)
+
+db_backup()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
From e321180b57390e3637fcc49a717d5d9fc51e999d Mon Sep 17 00:00:00 2001
From: Yenthe
Date: Mon, 11 May 2015 14:26:39 +0200
Subject: [PATCH 07/74] Flemish translations
Flemish translations are identical to Dutch.
---
auto_backup/i18n/nl_BE.po | 292 ++++++++++++++++++++++++++++++++++++++
1 file changed, 292 insertions(+)
create mode 100644 auto_backup/i18n/nl_BE.po
diff --git a/auto_backup/i18n/nl_BE.po b/auto_backup/i18n/nl_BE.po
new file mode 100644
index 00000000000..8d739798b29
--- /dev/null
+++ b/auto_backup/i18n/nl_BE.po
@@ -0,0 +1,292 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * auto_backup
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-03-26 14:17+0000\n"
+"PO-Revision-Date: 2015-03-26 14:17+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:137
+#, python-format
+msgid "%s"
+msgstr "%s"
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr "Absoluut pad om backups te bewaren"
+
+#. module: auto_backup
+#: field:db.backup,sendmailsftpfail:0
+msgid "Auto. E-mail on backup fail"
+msgstr "Auto. e-mailen wanneer backup mislukt"
+
+#. module: auto_backup
+#: field:db.backup,autoremove:0
+msgid "Auto. Remove Backups"
+msgstr "Auto. backups verwijderen"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Automatic backups of the database can be scheduled as follows:"
+msgstr "Automatische backups van de database kunnen als volgend gepland worden:"
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr "Backup folder"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_tree
+msgid "Backups"
+msgstr "Backups"
+
+#. module: auto_backup
+#: help:db.backup,daystokeepsftp:0
+msgid "Choose after how many days the backup should be deleted from the FTP server. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days from the FTP server."
+msgstr "Kies na hoeveel dagen de backups verwijderd moeten worden van de FTP server. Bijvoorbeeld:\n"
+"Als u 5 invult zal de backup na 5 dagen verwijderd worden van de FTP server."
+
+#. module: auto_backup
+#: help:db.backup,daystokeep:0
+msgid "Choose after how many days the backup should be deleted. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days."
+msgstr "Kies na hoeveel dagen de backup verwijderd moet worden. Bijvoorbeeld:\n"
+"Als u 5 invult zal de backup verwijderd worden na 5 dagen."
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr "Configureer backup"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Contact us!"
+msgstr "Contacteer ons!"
+
+#. module: auto_backup
+#: field:db.backup,create_uid:0
+msgid "Created by"
+msgstr "Gemaakt door"
+
+#. module: auto_backup
+#: field:db.backup,create_date:0
+msgid "Created on"
+msgstr "Gemaakt op"
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr "Database"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr "Database waar u backups voor wilt plannen"
+
+#. module: auto_backup
+#: field:db.backup,emailtonotify:0
+msgid "E-mail to notify"
+msgstr "E-mail om te verwittigen"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:106
+#: constraint:db.backup:0
+#, python-format
+msgid "Error ! No such database exists!"
+msgstr "Error! Deze database bestaat niet!"
+
+#. module: auto_backup
+#: help:db.backup,emailtonotify:0
+msgid "Fill in the e-mail where you want to be notified that the backup failed on the FTP."
+msgstr "Vul de e-mail in waarop u wilt verwittigd worden als de backup mislukt op de FTP."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "For example: /odoo/backups/"
+msgstr "Bijvoorbeeld: /odoo/backups/"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Go to Settings / Technical / Automation / Scheduled Actions."
+msgstr "Ga naar Instellingen / Technsich / Automatisering / Geplande acties"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Help"
+msgstr "Help"
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr "Host"
+
+#. module: auto_backup
+#: field:db.backup,id:0
+msgid "ID"
+msgstr "ID"
+
+#. module: auto_backup
+#: field:db.backup,sftpip:0
+msgid "IP Address SFTP Server"
+msgstr "IP adres SFTP server"
+
+#. module: auto_backup
+#: help:db.backup,sendmailsftpfail:0
+msgid "If you check this option you can choose to automaticly get e-mailed when the backup to the external server failed."
+msgstr "Als u deze optie aanvinkt kan u kiezen om automatisch een e-mail aan te krijgen als de backup
+naar de externe server mislukt."
+
+#. module: auto_backup
+#: help:db.backup,autoremove:0
+msgid "If you check this option you can choose to automaticly remove the backup after xx days"
+msgstr "Als u deze optie aanvinkt kan u kiezen om automatisch backups te verwijderen na xx dagen"
+
+#. module: auto_backup
+#: help:db.backup,sftpwrite:0
+msgid "If you check this option you can specify the details needed to write to a remote server with SFTP."
+msgstr "Als u deze optie aanvinkt kan u de details invullen die nodig zijn om te connecteren met de externe SFTP server."
+
+#. module: auto_backup
+#: field:db.backup,write_uid:0
+msgid "Last Updated by"
+msgstr "Laatst bijgewerkt door"
+
+#. module: auto_backup
+#: field:db.backup,write_date:0
+msgid "Last Updated on"
+msgstr "Laatst bijgewerkt op"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Local backup configuration"
+msgstr "Lokale backup configuratie"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Need more help?"
+msgstr "Meer hulp nodig?"
+
+#. module: auto_backup
+#: field:db.backup,sftppassword:0
+msgid "Password User SFTP Server"
+msgstr "Wachtwoord gebruiker SFTP server"
+
+#. module: auto_backup
+#: field:db.backup,sftppath:0
+msgid "Path external server"
+msgstr "Pad externe server"
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr "Poort"
+
+#. module: auto_backup
+#: field:db.backup,daystokeepsftp:0
+msgid "Remove SFTP after x days"
+msgstr "SFTP verwijderen na x dagen"
+
+#. module: auto_backup
+#: field:db.backup,daystokeep:0
+msgid "Remove after x days"
+msgstr "Verwijderen na x dagen"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "SFTP"
+msgstr "SFTP"
+
+#. module: auto_backup
+#: field:db.backup,sftpport:0
+msgid "SFTP Port"
+msgstr "SFTP poort"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_search
+msgid "Search options"
+msgstr "Zoekopties"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Search the action named 'Backup scheduler'."
+msgstr "Zoek de actie genaamd 'Backup scheduler'."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Set the scheduler to active and fill in how often you want backups generated."
+msgstr "Zet de planner op actief en vul in hoe vaak de backup moet gemaakt worden."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test"
+msgstr "Test"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test SFTP Connection"
+msgstr "Test SFTP Connectie"
+
+#. module: auto_backup
+#: help:db.backup,sftpip:0
+msgid "The IP address from your remote server. For example 192.168.0.1"
+msgstr "Het IP adres van uw externe server. Bijvoorbeeld: 192.168.0.1"
+
+#. module: auto_backup
+#: help:db.backup,sftppath:0
+msgid "The location to the folder where the dumps should be written to. For example /odoo/backups/.\n"
+"Files will then be written to /odoo/backups/ on your remote server."
+msgstr "De locatie naar de folder waar de backup naar toe moet geschreven worden. Bijvoorbeeld odoo/backups/\n"
+"Bestanden worden dan naar /odoo/backups/ geschreven op de externe server"
+
+#. module: auto_backup
+#: help:db.backup,sftppassword:0
+msgid "The password from the user where the SFTP connection should be made with. This is the password from the user on the external server."
+msgstr "Het wachtwoord van de gebruiker waar de SFTP connectie mee moet gemaakt worden. Dit is het wachtwoord van de gebruiker op de externe server."
+
+#. module: auto_backup
+#: help:db.backup,sftpport:0
+msgid "The port on the FTP server that accepts SSH/SFTP calls."
+msgstr "De poort op de FTP server die SSH/SFTP accepteert."
+
+#. module: auto_backup
+#: help:db.backup,sftpusername:0
+msgid "The username where the SFTP connection should be made with. This is the user on the external server."
+msgstr "De gebruikersnaam waar de SFTP connectie mee gemaakt moet worden. Dit is de gebruiker op de externe server."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
+msgstr "Dit configureert de planner voor automatische backups op de ingegeven database waar de host, poort en database op zijn ingegeven voor reguliere intervallen."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Use SFTP with caution! This writes files to external servers under the path you specify."
+msgstr "Gebruik SFTP voorzichtig! Dit schrijft bestanden naar externe servers onder het pad dat u opgeeft."
+
+#. module: auto_backup
+#: field:db.backup,sftpusername:0
+msgid "Username SFTP Server"
+msgstr "Gebruikersnaam SFTP Server"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Warning:"
+msgstr "Waarschuwing:"
+
+#. module: auto_backup
+#: field:db.backup,sftpwrite:0
+msgid "Write to external server with sftp"
+msgstr "Schrijf naar externe server met SFTP"
From 658e680be7ebed194f3f55618bc6c9019b5e0a66 Mon Sep 17 00:00:00 2001
From: Alessio Gerace
Date: Mon, 11 May 2015 14:50:32 +0200
Subject: [PATCH 08/74] 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.
---
auto_backup/backup_scheduler.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/auto_backup/backup_scheduler.py b/auto_backup/backup_scheduler.py
index 6ec77a90318..cf23b402cf3 100644
--- a/auto_backup/backup_scheduler.py
+++ b/auto_backup/backup_scheduler.py
@@ -152,7 +152,6 @@ def schedule_backup(self, cr, user, context={}):
#Create name for dumpfile.
bkp_file='%s_%s.dump' % (time.strftime('%d_%m_%Y_%H_%M_%S'),rec.name)
file_path = os.path.join(rec.bkp_dir,bkp_file)
- fp = open(file_path,'wb')
uri = 'http://' + rec.host + ':' + rec.port
conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/db')
bkp=''
@@ -162,6 +161,7 @@ def schedule_backup(self, cr, user, context={}):
logger.notifyChannel('backup', netsvc.LOG_INFO, "Could'nt backup database %s. Bad database administrator password for server running at http://%s:%s" %(rec.name, rec.host, rec.port))
continue
bkp = base64.decodestring(bkp)
+ fp = open(file_path,'wb')
fp.write(bkp)
fp.close()
else:
From 2de9523807383dc6d2a1c2b504c8eba552c672ef Mon Sep 17 00:00:00 2001
From: Alessio Gerace
Date: Tue, 14 Jul 2015 11:22:24 +0200
Subject: [PATCH 09/74] Porting module to OCA 8.0
---
auto_backup/README.rst | 99 ++++++++++++
auto_backup/__openerp__.py | 40 +++++
auto_backup/backup_data.xml | 18 +++
auto_backup/bkp_conf_view.xml | 112 +++++++++++++
auto_backup/data/backup_data.xml | 18 +++
auto_backup/i18n/ca.po | 157 +++++++++++++++++++
auto_backup/i18n/fr_BE.po | 141 +++++++++++++++++
auto_backup/{ => model}/backup_scheduler.py | 0
auto_backup/static/description/index.html | 100 ++++++++++++
auto_backup/static/description/no_index.html | 100 ++++++++++++
auto_backup/view/bkp_conf_view.xml | 112 +++++++++++++
11 files changed, 897 insertions(+)
create mode 100644 auto_backup/README.rst
create mode 100644 auto_backup/__openerp__.py
create mode 100644 auto_backup/backup_data.xml
create mode 100644 auto_backup/bkp_conf_view.xml
create mode 100644 auto_backup/data/backup_data.xml
create mode 100644 auto_backup/i18n/ca.po
create mode 100644 auto_backup/i18n/fr_BE.po
rename auto_backup/{ => model}/backup_scheduler.py (100%)
create mode 100644 auto_backup/static/description/index.html
create mode 100644 auto_backup/static/description/no_index.html
create mode 100644 auto_backup/view/bkp_conf_view.xml
diff --git a/auto_backup/README.rst b/auto_backup/README.rst
new file mode 100644
index 00000000000..123008f4c28
--- /dev/null
+++ b/auto_backup/README.rst
@@ -0,0 +1,99 @@
+.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
+ :alt: License: AGPL-3
+
+Automated backups
+===========
+
+A tool for all your back-ups, internal and external!
+
+Installation
+============
+
+Before to install this module, you need to:
+
+instal pysftp via pip.
+
+Configuration
+=============
+
+To configure this module, you need to:
+
+* go to ...
+
+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!
+
+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
+a path and everything will be backed up automatically. This is done
+through an SSH (encrypted) tunnel, thanks to pysftp, so your data is
+safe!
+
+Test connection
+---------------
+
+#### 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
+SFTP Connection’ button and you will get message telling you if
+everything is OK, or what is wrong!
+
+E-mail on backup failure
+------------------------
+
+#### 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.
+
+
+Known issues / Roadmap
+======================
+
+* ...
+
+Bug Tracker
+===========
+
+Bugs are tracked on `GitHub Issues `_.
+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 `_.
+
+
+Credits
+=======
+
+Contributors
+------------
+
+* Yenthe Van Ginneken
+* Alessio Gerace
+
+Maintainer
+----------
+
+.. image:: https://odoo-community.org/logo.png
+ :alt: Odoo Community Association
+ :target: https://odoo-community.org
+
+This module is maintained by the OCA.
+
+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.
\ No newline at end of file
diff --git a/auto_backup/__openerp__.py b/auto_backup/__openerp__.py
new file mode 100644
index 00000000000..a72d57c43b2
--- /dev/null
+++ b/auto_backup/__openerp__.py
@@ -0,0 +1,40 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# 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 .
+#
+##############################################################################
+
+{
+ "name" : "Database Auto-Backup",
+ "version" : "1.0",
+ "author" : "VanRoey.be - Yenthe Van Ginneken, Agile Business Group",
+ "website" : "http://www.vanroey.be/applications/bedrijfsbeheer/odoo",
+ "category" : "Tools",
+ "summary": "Backups data base",
+ "depends" : ['base'],
+ "init_xml" : [],
+ "demo_xml" : [],
+ "update_xml" : [
+ "view/bkp_conf_view.xml",
+ "data/backup_data.xml"
+ ],
+ "active": False,
+ "installable": True
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/auto_backup/backup_data.xml b/auto_backup/backup_data.xml
new file mode 100644
index 00000000000..0ab3c103149
--- /dev/null
+++ b/auto_backup/backup_data.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/auto_backup/bkp_conf_view.xml b/auto_backup/bkp_conf_view.xml
new file mode 100644
index 00000000000..27e56937e61
--- /dev/null
+++ b/auto_backup/bkp_conf_view.xml
@@ -0,0 +1,112 @@
+
+
+
+
+ Configure Backup
+ db.backup
+ form
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ form
+ tree,form
+
+
+
+
+
\ No newline at end of file
diff --git a/auto_backup/data/backup_data.xml b/auto_backup/data/backup_data.xml
new file mode 100644
index 00000000000..0ab3c103149
--- /dev/null
+++ b/auto_backup/data/backup_data.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/auto_backup/i18n/ca.po b/auto_backup/i18n/ca.po
new file mode 100644
index 00000000000..cb9e2f1d36b
--- /dev/null
+++ b/auto_backup/i18n/ca.po
@@ -0,0 +1,157 @@
+# Catalan translation for openobject-addons
+# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014
+# This file is distributed under the same license as the openobject-addons package.
+# FIRST AUTHOR , 2014.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: openobject-addons\n"
+"Report-Msgid-Bugs-To: FULL NAME \n"
+"POT-Creation-Date: 2009-11-24 13:49+0000\n"
+"PO-Revision-Date: 2014-10-20 06:41+0000\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: Catalan \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2014-10-21 06:30+0000\n"
+"X-Generator: Launchpad (build 17203)\n"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.model:0
+msgid ""
+"The Object name must start with x_ and not contain any special character !"
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.actions.act_window:0
+msgid "Invalid model name in the action definition."
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.model,name:auto_backup.model_db_backup
+msgid "db.backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid ""
+"1) Go to Administration / Configuration / Scheduler / Scheduled Actions"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Test"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "IP Configuration"
+msgstr ""
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.module.module,shortdesc:auto_backup.module_meta_information
+msgid "Database Auto-Backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Database Configuration"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "4) Set other values as per your preference"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid ""
+"Automatic backup of all the databases under this can be scheduled as "
+"follows: "
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.ui.view:0
+msgid "Invalid XML for View Architecture!"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "2) Schedule new action(create a new record)"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.module.module,description:auto_backup.module_meta_information
+msgid ""
+"The generic Open ERP Database Auto-Backup system enables the user to make "
+"configurations for the automatic backup of the database.\n"
+"User simply requires to specify host & port under IP Configuration & "
+"database(on specified host running at specified port) and backup "
+"directory(in which all the backups of the specified database will be stored) "
+"under Database Configuration.\n"
+"\n"
+"Automatic backup for all such configured databases under this can then be "
+"scheduled as follows: \n"
+" \n"
+"1) Go to Administration / Configuration / Scheduler / Scheduled Actions\n"
+"2) Schedule new action(create a new record)\n"
+"3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under "
+"page 'Technical Data'\n"
+"4) Set other values as per your preference"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid ""
+"3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under "
+"page 'Technical Data'"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Help"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid ""
+"This configures the scheduler for automatic backup of the given database "
+"running on given host at given port on regular intervals."
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr ""
diff --git a/auto_backup/i18n/fr_BE.po b/auto_backup/i18n/fr_BE.po
new file mode 100644
index 00000000000..c560ff6eed9
--- /dev/null
+++ b/auto_backup/i18n/fr_BE.po
@@ -0,0 +1,141 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * auto_backup
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 5.0.6\n"
+"Report-Msgid-Bugs-To: support@openerp.com\n"
+"POT-Creation-Date: 2009-11-24 13:49:51+0000\n"
+"PO-Revision-Date: 2009-11-24 13:49:51+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.model:0
+msgid "The Object name must start with x_ and not contain any special character !"
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.actions.act_window:0
+msgid "Invalid model name in the action definition."
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.model,name:auto_backup.model_db_backup
+msgid "db.backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "1) Go to Administration / Configuration / Scheduler / Scheduled Actions"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Test"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "IP Configuration"
+msgstr ""
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.module.module,shortdesc:auto_backup.module_meta_information
+msgid "Database Auto-Backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Database Configuration"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "4) Set other values as per your preference"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Automatic backup of all the databases under this can be scheduled as follows: "
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.ui.view:0
+msgid "Invalid XML for View Architecture!"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "2) Schedule new action(create a new record)"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.module.module,description:auto_backup.module_meta_information
+msgid "The generic Open ERP Database Auto-Backup system enables the user to make configurations for the automatic backup of the database.\n"
+"User simply requires to specify host & port under IP Configuration & database(on specified host running at specified port) and backup directory(in which all the backups of the specified database will be stored) under Database Configuration.\n"
+"\n"
+"Automatic backup for all such configured databases under this can then be scheduled as follows: \n"
+" \n"
+"1) Go to Administration / Configuration / Scheduler / Scheduled Actions\n"
+"2) Schedule new action(create a new record)\n"
+"3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under page 'Technical Data'\n"
+"4) Set other values as per your preference"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under page 'Technical Data'"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Help"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr ""
+
diff --git a/auto_backup/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
similarity index 100%
rename from auto_backup/backup_scheduler.py
rename to auto_backup/model/backup_scheduler.py
diff --git a/auto_backup/static/description/index.html b/auto_backup/static/description/index.html
new file mode 100644
index 00000000000..6b3ba3e2b6d
--- /dev/null
+++ b/auto_backup/static/description/index.html
@@ -0,0 +1,100 @@
+
+
+
+
Automated backups
+
A tool for all your back-ups, internal and external!
+
+
+
+
+
+
+
+
+ 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!
+
+ 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 a path and everything will be backed up automatically. This is done through an SSH (encrypted) tunnel, thanks to pysftp, so your data is safe!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Test connection
+
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 SFTP Connection' button and you will get message telling you if everything is OK, or what is wrong!
+
+
+
+
+
+
+
+
E-mail on backup failure
+
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.
+
A tool for all your back-ups, internal and external!
+
+
+
+
+
+
+
+
+ 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!
+
+ 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 a path and everything will be backed up automatically. This is done through an SSH (encrypted) tunnel, thanks to pysftp, so your data is safe!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Test connection
+
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 SFTP Connection' button and you will get message telling you if everything is OK, or what is wrong!
+
+
+
+
+
+
+
+
E-mail on backup failure
+
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.
+
+
diff --git a/auto_backup/view/bkp_conf_view.xml b/auto_backup/view/bkp_conf_view.xml
new file mode 100644
index 00000000000..27e56937e61
--- /dev/null
+++ b/auto_backup/view/bkp_conf_view.xml
@@ -0,0 +1,112 @@
+
+
+
+
+ Configure Backup
+ db.backup
+ form
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ form
+ tree,form
+
+
+
+
+
\ No newline at end of file
From 2d0401914ebf20d8675e10ad59359272109cbe0b Mon Sep 17 00:00:00 2001
From: Alessio Gerace
Date: Tue, 14 Jul 2015 11:25:24 +0200
Subject: [PATCH 10/74] [FIX] module
---
auto_backup/__init__.py | 24 ++++++++++++++++++++++++
auto_backup/__openerp__.py | 2 +-
auto_backup/model/__init__.py | 23 +++++++++++++++++++++++
3 files changed, 48 insertions(+), 1 deletion(-)
create mode 100644 auto_backup/__init__.py
create mode 100644 auto_backup/model/__init__.py
diff --git a/auto_backup/__init__.py b/auto_backup/__init__.py
new file mode 100644
index 00000000000..b90f7bb0897
--- /dev/null
+++ b/auto_backup/__init__.py
@@ -0,0 +1,24 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+# Copyright (C) 2015 Agile Business Group
+# 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 .
+#
+##############################################################################
+
+from . import model
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/auto_backup/__openerp__.py b/auto_backup/__openerp__.py
index a72d57c43b2..64f232256f6 100644
--- a/auto_backup/__openerp__.py
+++ b/auto_backup/__openerp__.py
@@ -4,7 +4,7 @@
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
# $Id$
-#
+# Copyright (C) 2015 Agile Business Group
# 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
diff --git a/auto_backup/model/__init__.py b/auto_backup/model/__init__.py
new file mode 100644
index 00000000000..9fa9047c2f3
--- /dev/null
+++ b/auto_backup/model/__init__.py
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# 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 .
+#
+##############################################################################
+
+import backup_scheduler
From da0352fba2b39a98f396ba700e4eb43464c189dd Mon Sep 17 00:00:00 2001
From: archetipo
Date: Mon, 20 Jul 2015 17:38:04 +0200
Subject: [PATCH 11/74] [FIX] bug logger --> _logger call [FIX] Flake8 [RM]
useless files
---
auto_backup/README.rst | 2 +-
auto_backup/data/backup_data.xml | 34 +--
auto_backup/i18n/ca.po | 157 -----------
auto_backup/i18n/fr_BE.po | 141 ----------
auto_backup/model/__init__.py | 2 +-
auto_backup/model/backup_scheduler.py | 376 ++++++++++++++++++--------
auto_backup/view/bkp_conf_view.xml | 208 +++++++-------
7 files changed, 378 insertions(+), 542 deletions(-)
delete mode 100644 auto_backup/i18n/ca.po
delete mode 100644 auto_backup/i18n/fr_BE.po
diff --git a/auto_backup/README.rst b/auto_backup/README.rst
index 123008f4c28..d2a9f55c1b1 100644
--- a/auto_backup/README.rst
+++ b/auto_backup/README.rst
@@ -71,7 +71,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
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 `_.
+`here `_.
Credits
diff --git a/auto_backup/data/backup_data.xml b/auto_backup/data/backup_data.xml
index 0ab3c103149..4714778a5cc 100644
--- a/auto_backup/data/backup_data.xml
+++ b/auto_backup/data/backup_data.xml
@@ -1,18 +1,18 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/auto_backup/i18n/ca.po b/auto_backup/i18n/ca.po
deleted file mode 100644
index cb9e2f1d36b..00000000000
--- a/auto_backup/i18n/ca.po
+++ /dev/null
@@ -1,157 +0,0 @@
-# Catalan translation for openobject-addons
-# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014
-# This file is distributed under the same license as the openobject-addons package.
-# FIRST AUTHOR , 2014.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: openobject-addons\n"
-"Report-Msgid-Bugs-To: FULL NAME \n"
-"POT-Creation-Date: 2009-11-24 13:49+0000\n"
-"PO-Revision-Date: 2014-10-20 06:41+0000\n"
-"Last-Translator: FULL NAME \n"
-"Language-Team: Catalan \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-10-21 06:30+0000\n"
-"X-Generator: Launchpad (build 17203)\n"
-
-#. module: auto_backup
-#: help:db.backup,name:0
-msgid "Database you want to schedule backups for"
-msgstr ""
-
-#. module: auto_backup
-#: constraint:ir.model:0
-msgid ""
-"The Object name must start with x_ and not contain any special character !"
-msgstr ""
-
-#. module: auto_backup
-#: constraint:ir.actions.act_window:0
-msgid "Invalid model name in the action definition."
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.model,name:auto_backup.model_db_backup
-msgid "db.backup"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid ""
-"1) Go to Administration / Configuration / Scheduler / Scheduled Actions"
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
-#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
-msgid "Configure Backup"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "Test"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "IP Configuration"
-msgstr ""
-
-#. module: auto_backup
-#: help:db.backup,bkp_dir:0
-msgid "Absolute path for storing the backups"
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.module.module,shortdesc:auto_backup.module_meta_information
-msgid "Database Auto-Backup"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "Database Configuration"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "4) Set other values as per your preference"
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,host:0
-msgid "Host"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid ""
-"Automatic backup of all the databases under this can be scheduled as "
-"follows: "
-msgstr ""
-
-#. module: auto_backup
-#: constraint:ir.ui.view:0
-msgid "Invalid XML for View Architecture!"
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,bkp_dir:0
-msgid "Backup Directory"
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,name:0
-msgid "Database"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "2) Schedule new action(create a new record)"
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.module.module,description:auto_backup.module_meta_information
-msgid ""
-"The generic Open ERP Database Auto-Backup system enables the user to make "
-"configurations for the automatic backup of the database.\n"
-"User simply requires to specify host & port under IP Configuration & "
-"database(on specified host running at specified port) and backup "
-"directory(in which all the backups of the specified database will be stored) "
-"under Database Configuration.\n"
-"\n"
-"Automatic backup for all such configured databases under this can then be "
-"scheduled as follows: \n"
-" \n"
-"1) Go to Administration / Configuration / Scheduler / Scheduled Actions\n"
-"2) Schedule new action(create a new record)\n"
-"3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under "
-"page 'Technical Data'\n"
-"4) Set other values as per your preference"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid ""
-"3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under "
-"page 'Technical Data'"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "Help"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid ""
-"This configures the scheduler for automatic backup of the given database "
-"running on given host at given port on regular intervals."
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,port:0
-msgid "Port"
-msgstr ""
diff --git a/auto_backup/i18n/fr_BE.po b/auto_backup/i18n/fr_BE.po
deleted file mode 100644
index c560ff6eed9..00000000000
--- a/auto_backup/i18n/fr_BE.po
+++ /dev/null
@@ -1,141 +0,0 @@
-# Translation of OpenERP Server.
-# This file contains the translation of the following modules:
-# * auto_backup
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: OpenERP Server 5.0.6\n"
-"Report-Msgid-Bugs-To: support@openerp.com\n"
-"POT-Creation-Date: 2009-11-24 13:49:51+0000\n"
-"PO-Revision-Date: 2009-11-24 13:49:51+0000\n"
-"Last-Translator: <>\n"
-"Language-Team: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: \n"
-"Plural-Forms: \n"
-
-#. module: auto_backup
-#: help:db.backup,name:0
-msgid "Database you want to schedule backups for"
-msgstr ""
-
-#. module: auto_backup
-#: constraint:ir.model:0
-msgid "The Object name must start with x_ and not contain any special character !"
-msgstr ""
-
-#. module: auto_backup
-#: constraint:ir.actions.act_window:0
-msgid "Invalid model name in the action definition."
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.model,name:auto_backup.model_db_backup
-msgid "db.backup"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "1) Go to Administration / Configuration / Scheduler / Scheduled Actions"
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
-#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
-msgid "Configure Backup"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "Test"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "IP Configuration"
-msgstr ""
-
-#. module: auto_backup
-#: help:db.backup,bkp_dir:0
-msgid "Absolute path for storing the backups"
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.module.module,shortdesc:auto_backup.module_meta_information
-msgid "Database Auto-Backup"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "Database Configuration"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "4) Set other values as per your preference"
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,host:0
-msgid "Host"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "Automatic backup of all the databases under this can be scheduled as follows: "
-msgstr ""
-
-#. module: auto_backup
-#: constraint:ir.ui.view:0
-msgid "Invalid XML for View Architecture!"
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,bkp_dir:0
-msgid "Backup Directory"
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,name:0
-msgid "Database"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "2) Schedule new action(create a new record)"
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.module.module,description:auto_backup.module_meta_information
-msgid "The generic Open ERP Database Auto-Backup system enables the user to make configurations for the automatic backup of the database.\n"
-"User simply requires to specify host & port under IP Configuration & database(on specified host running at specified port) and backup directory(in which all the backups of the specified database will be stored) under Database Configuration.\n"
-"\n"
-"Automatic backup for all such configured databases under this can then be scheduled as follows: \n"
-" \n"
-"1) Go to Administration / Configuration / Scheduler / Scheduled Actions\n"
-"2) Schedule new action(create a new record)\n"
-"3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under page 'Technical Data'\n"
-"4) Set other values as per your preference"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under page 'Technical Data'"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "Help"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,port:0
-msgid "Port"
-msgstr ""
-
diff --git a/auto_backup/model/__init__.py b/auto_backup/model/__init__.py
index 9fa9047c2f3..a5a7ebdd8e3 100644
--- a/auto_backup/model/__init__.py
+++ b/auto_backup/model/__init__.py
@@ -20,4 +20,4 @@
#
##############################################################################
-import backup_scheduler
+from . import backup_scheduler
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index cf23b402cf3..bbe24d25108 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -1,25 +1,23 @@
-# -*- encoding: utf-8 -*-
+# -*- encoding: utf-8 -*-
##############################################################################
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
-# $Id$
+# 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 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.
#
-# 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 .
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
#
##############################################################################
-
import xmlrpclib
import socket
import os
@@ -30,27 +28,32 @@
try:
import pysftp
except ImportError:
- raise ImportError('This module needs pysftp to automaticly write backups to the FTP through SFTP.Please install pysftp on your system.(sudo pip install pysftp)')
-from openerp.osv import fields,osv,orm
+ raise ImportError(
+ 'This module needs pysftp to automaticly write backups to the FTP '
+ 'through SFTP.Please install pysftp on your system.'
+ '(sudo pip install pysftp)'
+ )
+from openerp.osv import fields, osv
from openerp import tools
-from openerp import netsvc
-from openerp import tools, _
+from openerp import netsvc, _
import logging
_logger = logging.getLogger(__name__)
+
def execute(connector, method, *args):
res = False
- try:
- res = getattr(connector,method)(*args)
- except socket.error,e:
- raise e
+ try:
+ res = getattr(connector, method)(*args)
+ except socket.error as e:
+ raise e
return res
addons_path = tools.config['addons_path'] + '/auto_backup/DBbackups'
+
class db_backup(osv.Model):
_name = 'db.backup'
-
+
def get_db_list(self, cr, user, ids, host, port, context={}):
print("Host: " + host)
print("Port: " + port)
@@ -59,88 +62,165 @@ def get_db_list(self, cr, user, ids, host, port, context={}):
db_list = execute(conn, 'list')
return db_list
- def _get_db_name(self,cr,uid, vals,context=None):
- attach_pool = self.pool.get("ir.logging")
+ def _get_db_name(self, cr, uid, vals, context=None):
+ # attach_pool = self.pool.get("ir.logging")
dbName = cr.dbname
return dbName
-
+
_columns = {
- #Columns local server
- 'host' : fields.char('Host', size=100, required='True'),
- 'port' : fields.char('Port', size=10, required='True'),
- 'name' : fields.char('Database', size=100, required='True',help='Database you want to schedule backups for'),
- 'bkp_dir' : fields.char('Backup Directory', size=100, help='Absolute path for storing the backups', required='True'),
- 'autoremove': fields.boolean('Auto. Remove Backups', help="If you check this option you can choose to automaticly remove the backup after xx days"),
- 'daystokeep': fields.integer('Remove after x days',
- help="Choose after how many days the backup should be deleted. For example:\nIf you fill in 5 the backups will be removed after 5 days.",required=True),
- #Columns for external server (SFTP)
- 'sftpwrite': fields.boolean('Write to external server with sftp', help="If you check this option you can specify the details needed to write to a remote server with SFTP."),
- 'sftppath': fields.char('Path external server', help="The location to the folder where the dumps should be written to. For example /odoo/backups/.\nFiles will then be written to /odoo/backups/ on your remote server."),
- 'sftpip': fields.char('IP Address SFTP Server', help="The IP address from your remote server. For example 192.168.0.1"),
- 'sftpport': fields.integer("SFTP Port", help="The port on the FTP server that accepts SSH/SFTP calls."),
- 'sftpusername': fields.char('Username SFTP Server', help="The username where the SFTP connection should be made with. This is the user on the external server."),
- 'sftppassword': fields.char('Password User SFTP Server', help="The password from the user where the SFTP connection should be made with. This is the password from the user on the external server."),
- 'daystokeepsftp': fields.integer('Remove SFTP after x days', help="Choose after how many days the backup should be deleted from the FTP server. For example:\nIf you fill in 5 the backups will be removed after 5 days from the FTP server."),
- 'sendmailsftpfail': fields.boolean('Auto. E-mail on backup fail', help="If you check this option you can choose to automaticly get e-mailed when the backup to the external server failed."),
- 'emailtonotify': fields.char('E-mail to notify', help="Fill in the e-mail where you want to be notified that the backup failed on the FTP."),
- }
+ # Columns local server
+ 'host': fields.char('Host', size=100, required='True'),
+ 'port': fields.char('Port', size=10, required='True'),
+ 'name': fields.char(
+ 'Database', size=100, required='True',
+ help='Database you want to schedule backups for'
+ ),
+ 'bkp_dir': fields.char(
+ 'Backup Directory', size=100,
+ help='Absolute path for storing the backups',
+ required='True'
+ ),
+ 'autoremove': fields.boolean(
+ 'Auto. Remove Backups',
+ help=(
+ "If you check this option you can choose to "
+ "automaticly remove the backup after xx days"
+ )
+ ),
+ 'daystokeep': fields.integer(
+ 'Remove after x days',
+ help=(
+ "Choose after how many days the backup should be "
+ "deleted. For example:\nIf you fill in 5 the backups "
+ "will be removed after 5 days."
+ ), required=True
+ ),
+ # Columns for external server (SFTP)
+ 'sftpwrite': fields.boolean(
+ 'Write to external server with sftp',
+ help=(
+ "If you check this option you can specify the details "
+ "needed to write to a remote server with SFTP."
+ )
+ ),
+ 'sftppath': fields.char(
+ 'Path external server',
+ help=(
+ "The location to the folder where the dumps should be "
+ "written to. For example /odoo/backups/.\nFiles will then"
+ " be written to /odoo/backups/ on your remote server."
+ )
+ ),
+ 'sftpip': fields.char(
+ 'IP Address SFTP Server',
+ help=(
+ "The IP address from your remote"
+ " server. For example 192.168.0.1"
+ )
+ ),
+ 'sftpport': fields.integer(
+ "SFTP Port",
+ help="The port on the FTP server that accepts SSH/SFTP calls."
+ ),
+ 'sftpusername': fields.char(
+ 'Username SFTP Server',
+ help=(
+ "The username where the SFTP connection "
+ "should be made with. This is the user on the external server."
+ )
+ ),
+ 'sftppassword': fields.char(
+ 'Password User SFTP Server',
+ help=(
+ "The password from the user where the SFTP connection "
+ "should be made with. This is the password from the user"
+ " on the external server."
+ )
+ ),
+ 'daystokeepsftp': fields.integer(
+ 'Remove SFTP after x days',
+ help=(
+ "Choose after how many days the backup should be deleted "
+ "from the FTP server. For example:\nIf you fill in 5 the "
+ "backups will be removed after 5 days from the FTP server."
+ )
+ ),
+ 'sendmailsftpfail': fields.boolean(
+ 'Auto. E-mail on backup fail', help=(
+ "If you check this option you can choose to automaticly"
+ " get e-mailed when the backup to the external server failed."
+ )
+ ),
+ 'emailtonotify': fields.char(
+ 'E-mail to notify',
+ help=(
+ "Fill in the e-mail where you want to be"
+ " notified that the backup failed on the FTP."
+ )
+ ),
+ }
_defaults = {
- #'bkp_dir' : lambda *a : addons_path,
- 'bkp_dir' : '/odoo/backups',
- 'host' : lambda *a : 'localhost',
- 'port' : lambda *a : '8069',
- 'name': _get_db_name,
- 'daystokeepsftp': 30,
- 'sftpport': 22,
- }
-
+ # 'bkp_dir' : lambda *a : addons_path,
+ 'bkp_dir': '/odoo/backups',
+ 'host': lambda *a: 'localhost',
+ 'port': lambda *a: '8069',
+ 'name': _get_db_name,
+ 'daystokeepsftp': 30,
+ 'sftpport': 22,
+ }
+
def _check_db_exist(self, cr, user, ids):
- for rec in self.browse(cr,user,ids):
+ for rec in self.browse(cr, user, ids):
db_list = self.get_db_list(cr, user, ids, rec.host, rec.port)
if rec.name in db_list:
return True
return False
-
- _constraints = [
- (_check_db_exist, _('Error ! No such database exists!'), [])
- ]
+ _constraints = [
+ (_check_db_exist, _('Error ! No such database exists!'), [])
+ ]
def test_sftp_connection(self, cr, uid, ids, context=None):
- conf_ids= self.search(cr, uid, [])
- confs = self.browse(cr,uid,conf_ids)
- #Check if there is a success or fail and write messages
+ conf_ids = self.search(cr, uid, [])
+ confs = self.browse(cr, uid, conf_ids)
+ # Check if there is a success or fail and write messages
messageTitle = ""
messageContent = ""
for rec in confs:
- db_list = self.get_db_list(cr, uid, [], rec.host, rec.port)
+ # db_list = self.get_db_list(cr, uid, [], rec.host, rec.port)
try:
- pathToWriteTo = rec.sftppath
+ # pathToWriteTo = rec.sftppath
ipHost = rec.sftpip
portHost = rec.sftpport
usernameLogin = rec.sftpusername
passwordLogin = rec.sftppassword
- #Connect with external server over SFTP, so we know sure that everything works.
+ # Connect with external server over SFTP, so we know sure that
+ # everything works.
srv = pysftp.Connection(host=ipHost, username=usernameLogin,
-password=passwordLogin,port=portHost)
+ password=passwordLogin, port=portHost)
srv.close()
- #We have a success.
- messageTitle = "Connection Test Succeeded!"
- messageContent = "Everything seems properly set up for FTP back-ups!"
- except Exception, e:
- messageTitle = "Connection Test Failed!"
+ # We have a success.
+ messageTitle = _("Connection Test Succeeded!")
+ messageContent = _(
+ "Everything seems properly set up for FTP back-ups!")
+ except Exception as e:
+ messageTitle = _("Connection Test Failed!")
if len(rec.sftpip) < 8:
- messageContent += "\nYour IP address seems to be too short.\n"
+ messageContent += _(
+ "\nYour IP address seems to be too short.\n")
messageContent += "Here is what we got instead:\n"
if "Failed" in messageTitle:
- raise osv.except_osv(_(messageTitle), _(messageContent + "%s") % tools.ustr(e))
+ raise osv.except_osv(
+ _(messageTitle), _(
+ messageContent + "%s") %
+ tools.ustr(e))
else:
raise osv.except_osv(_(messageTitle), _(messageContent))
def schedule_backup(self, cr, user, context={}):
- conf_ids= self.search(cr, user, [])
- confs = self.browse(cr,user,conf_ids)
+ conf_ids = self.search(cr, user, [])
+ confs = self.browse(cr, user, conf_ids)
for rec in confs:
db_list = self.get_db_list(cr, user, [], rec.host, rec.port)
if rec.name in db_list:
@@ -149,93 +229,144 @@ def schedule_backup(self, cr, user, context={}):
os.makedirs(rec.bkp_dir)
except:
raise
- #Create name for dumpfile.
- bkp_file='%s_%s.dump' % (time.strftime('%d_%m_%Y_%H_%M_%S'),rec.name)
- file_path = os.path.join(rec.bkp_dir,bkp_file)
+ # Create name for dumpfile.
+ bkp_file = '%s_%s.dump' % (
+ time.strftime('%d_%m_%Y_%H_%M_%S'),
+ rec.name)
+ file_path = os.path.join(rec.bkp_dir, bkp_file)
uri = 'http://' + rec.host + ':' + rec.port
conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/db')
- bkp=''
+ bkp = ''
try:
- bkp = execute(conn, 'dump', tools.config['admin_passwd'], rec.name)
+ bkp = execute(
+ conn,
+ 'dump',
+ tools.config['admin_passwd'],
+ rec.name)
except:
+<<<<<<< HEAD
logger.notifyChannel('backup', netsvc.LOG_INFO, "Could'nt backup database %s. Bad database administrator password for server running at http://%s:%s" %(rec.name, rec.host, rec.port))
+=======
+ _logger.notifyChannel(
+ 'backup', netsvc.LOG_INFO,
+ _(
+ "Couldn't backup database %s. "
+ "Bad database administrator"
+ "password for server running at http://%s:%s"
+ ) % (rec.name, rec.host, rec.port))
+>>>>>>> f331fab... [FIX] bug logger --> _logger call
continue
bkp = base64.decodestring(bkp)
- fp = open(file_path,'wb')
+ fp = open(file_path, 'wb')
fp.write(bkp)
fp.close()
else:
- logger.notifyChannel('backup', netsvc.LOG_INFO, "database %s doesn't exist on http://%s:%s" %(rec.name, rec.host, rec.port))
+ _logger.notifyChannel(
+ 'backup', netsvc.LOG_INFO,
+ "database %s doesn't exist on http://%s:%s" %
+ (rec.name, rec.host, rec.port))
- #Check if user wants to write to SFTP or not.
+ # Check if user wants to write to SFTP or not.
if rec.sftpwrite is True:
try:
- #Store all values in variables
+ # Store all values in variables
dir = rec.bkp_dir
pathToWriteTo = rec.sftppath
ipHost = rec.sftpip
portHost = rec.sftpport
usernameLogin = rec.sftpusername
passwordLogin = rec.sftppassword
- #Connect with external server over SFTP
- srv = pysftp.Connection(host=ipHost, username=usernameLogin,
-password=passwordLogin, port=portHost)
- #Move to the correct directory on external server. If the user made a typo in his path with multiple slashes (/odoo//backups/) it will be fixed by this regex.
- pathToWriteTo = re.sub('([/]{2,5})+','/',pathToWriteTo)
+ # Connect with external server over SFTP
+ srv = pysftp.Connection(
+ host=ipHost,
+ username=usernameLogin,
+ password=passwordLogin,
+ port=portHost)
+ # Move to the correct directory on external server. If the
+ # user made a typo in his path with multiple slashes
+ # (/odoo//backups/) it will be fixed by this regex.
+ pathToWriteTo = re.sub('([/]{2,5})+', '/', pathToWriteTo)
print(pathToWriteTo)
try:
srv.chdir(pathToWriteTo)
except IOError:
- #Create directory and subdirs if they do not exist.
+ # Create directory and subdirs if they do not exist.
currentDir = ''
for dirElement in pathToWriteTo.split('/'):
currentDir += dirElement + '/'
try:
srv.chdir(currentDir)
except:
- print('(Part of the) path didn\'t exist. Creating it now at ' + currentDir)
- #Make directory and then navigate into it
+ _logger.info(
+ _(
+ '(Part of the) path didn\'t exist. '
+ 'Creating it now at %s'
+ ) % currentDir
+ )
+ # Make directory and then navigate into it
srv.mkdir(currentDir, mode=777)
srv.chdir(currentDir)
pass
srv.chdir(pathToWriteTo)
- #Loop over all files in the directory.
+ # Loop over all files in the directory.
for f in os.listdir(dir):
fullpath = os.path.join(dir, f)
if os.path.isfile(fullpath):
print(fullpath)
srv.put(fullpath)
- #Navigate in to the correct folder.
+ # Navigate in to the correct folder.
srv.chdir(pathToWriteTo)
- #Loop over all files in the directory from the back-ups.
- #We will check the creation date of every back-up.
+ # Loop over all files in the directory from the back-ups.
+ # We will check the creation date of every back-up.
for file in srv.listdir(pathToWriteTo):
- #Get the full path
- fullpath = os.path.join(pathToWriteTo,file)
- #Get the timestamp from the file on the external server
+ # Get the full path
+ fullpath = os.path.join(pathToWriteTo, file)
+ # Get the timestamp from the file on the external
+ # server
timestamp = srv.stat(fullpath).st_atime
createtime = datetime.datetime.fromtimestamp(timestamp)
now = datetime.datetime.now()
delta = now - createtime
- #If the file is older than the daystokeepsftp (the days to keep that the user filled in on the Odoo form it will be removed.
+ # If the file is older than the daystokeepsftp (the
+ # days to keep that the user filled in on the Odoo form
+ # it will be removed.
if delta.days >= rec.daystokeepsftp:
- #Only delete files, no directories!
+ # Only delete files, no directories!
if srv.isfile(fullpath) and ".dump" in file:
print("Delete: " + file)
srv.unlink(file)
- #Close the SFTP session.
+ # Close the SFTP session.
srv.close()
- except Exception, e:
- _logger.debug('Exception! We couldn\'t back up to the FTP server..')
- #At this point the SFTP backup failed. We will now check if the user wants
- #an e-mail notification about this.
+ except Exception as e:
+ _logger.debug(
+ 'Exception! We couldn\'t back '
+ 'up to the FTP server..'
+ )
+ # At this point the SFTP backup failed.
+ # We will now check if the user wants
+ # an e-mail notification about this.
if rec.sendmailsftpfail:
try:
- ir_mail_server = self.pool.get('ir.mail_server')
- message = "Dear,\n\nThe backup for the server " + rec.host + " (IP: " + rec.sftpip + ") failed.Please check the following details:\n\nIP address SFTP server: " + rec.sftpip + "\nUsername: " + rec.sftpusername + "\nPassword: " + rec.sftppassword + "\n\nError details: " + tools.ustr(e) + "\n\nWith kind regards"
- msg = ir_mail_server.build_email("auto_backup@" + rec.name + ".com", [rec.emailtonotify], "Backup from " + rec.host + "(" + rec.sftpip + ") failed", message)
+ ir_mail_server = self.pool.get('ir.mail_server')
+ message = (
+ "Dear,\n\nThe backup for the server %s"
+ " (IP: %s) failed.Please check"
+ " the following details:\n\n"
+ "IP address SFTP server: %s \nUsername: %s"
+ "\nPassword: %s"
+ "\n\nError details: %s \n\nWith kind regards"
+ ) % (
+ rec.host, rec.sftpip, rec.sftpip,
+ rec.sftpusername, rec.sftppassword,
+ tools.ustr(e)
+ )
+ msg = ir_mail_server.build_email(
+ "auto_backup@" + rec.name + ".com",
+ [rec.emailtonotify],
+ "Backup from " + rec.host + "(" + rec.sftpip +
+ ") failed", message)
ir_mail_server.send_email(cr, user, msg)
except Exception:
pass
@@ -243,25 +374,34 @@ def schedule_backup(self, cr, user, context={}):
"""Remove all old files (on local server) in case this is configured..
This is done after the SFTP writing to prevent unusual behaviour:
If the user would set local back-ups to be kept 0 days and the SFTP
- to keep backups xx days there wouldn't be any new back-ups added to the
- SFTP.
- If we'd remove the dump files before they're writen to the SFTP there willbe nothing to write. Meaning that if an user doesn't want to keep back-ups locally and only wants them on the SFTP (NAS for example) there wouldn't be any writing to the remote server if this if statement was before the SFTP write method right above this comment.
+ to keep backups xx days there wouldn't be any new back-ups added
+ to the SFTP.
+ If we'd remove the dump files before they're writen to the SFTP
+ there willbe nothing to write. Meaning that if an user doesn't want
+ to keep back-ups locally and only wants them on the SFTP
+ (NAS for example) there wouldn't be any writing to the
+ remote server if this if statement was before the SFTP write method
+ right above this comment.
"""
if rec.autoremove is True:
dir = rec.bkp_dir
- #Loop over all files in the directory.
+ # Loop over all files in the directory.
for f in os.listdir(dir):
fullpath = os.path.join(dir, f)
timestamp = os.stat(fullpath).st_ctime
createtime = datetime.datetime.fromtimestamp(timestamp)
now = datetime.datetime.now()
- delta = now - createtime
+ delta = now - createtime
if delta.days >= rec.daystokeep:
- #Only delete files (which are .dump), no directories.
+ # Only delete files (which are .dump), no directories.
if os.path.isfile(fullpath) and ".dump" in f:
print("Delete: " + fullpath)
os.remove(fullpath)
db_backup()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+<<<<<<< HEAD
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+=======
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+>>>>>>> f331fab... [FIX] bug logger --> _logger call
diff --git a/auto_backup/view/bkp_conf_view.xml b/auto_backup/view/bkp_conf_view.xml
index 27e56937e61..1f35678e663 100644
--- a/auto_backup/view/bkp_conf_view.xml
+++ b/auto_backup/view/bkp_conf_view.xml
@@ -1,112 +1,106 @@
-
-
- Configure Backup
- db.backup
- form
-
-
-
-
-
-
- Configure Backup
- db.backup
- tree
-
-
-
-
-
-
-
-
-
-
-
-
-
- Configure Backup
- db.backup
- search
-
-
-
-
-
-
-
-
-
-
-
+
+ Configure Backup
+ db.backup
+ form
+
+
+
+
-
- Configure Backup
- db.backup
- form
- tree,form
-
-
-
-
+
+ Configure Backup
+ db.backup
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ form
+ tree,form
+
+
+
+
+
\ No newline at end of file
From 7814ebbcf3a7e89d40ec78ed1b90f798f90cca44 Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 21 Jul 2015 09:16:42 +0200
Subject: [PATCH 12/74] [FIX] Readme.rst
---
auto_backup/README.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/auto_backup/README.rst b/auto_backup/README.rst
index d2a9f55c1b1..af72d17f3ec 100644
--- a/auto_backup/README.rst
+++ b/auto_backup/README.rst
@@ -68,7 +68,7 @@ Known issues / Roadmap
Bug Tracker
===========
-Bugs are tracked on `GitHub Issues `_.
+Bugs are tracked on `GitHub Issues `_.
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 `_.
From 6174ea93cce255a23aafee584161936d9c19a5de Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 21 Jul 2015 09:25:23 +0200
Subject: [PATCH 13/74] [FIX] defaults value
---
auto_backup/model/backup_scheduler.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index bbe24d25108..0c3983e0ed8 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -163,8 +163,8 @@ def _get_db_name(self, cr, uid, vals, context=None):
_defaults = {
# 'bkp_dir' : lambda *a : addons_path,
'bkp_dir': '/odoo/backups',
- 'host': lambda *a: 'localhost',
- 'port': lambda *a: '8069',
+ 'host': 'localhost',
+ 'port': '8069',
'name': _get_db_name,
'daystokeepsftp': 30,
'sftpport': 22,
From 915b20db31d2e729a01df4d1759b5712757aad4e Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 21 Jul 2015 10:15:26 +0200
Subject: [PATCH 14/74] [FIX] rebased commit
---
auto_backup/backup_data.xml | 18 -----
auto_backup/bkp_conf_view.xml | 112 --------------------------
auto_backup/model/backup_scheduler.py | 8 --
3 files changed, 138 deletions(-)
delete mode 100644 auto_backup/backup_data.xml
delete mode 100644 auto_backup/bkp_conf_view.xml
diff --git a/auto_backup/backup_data.xml b/auto_backup/backup_data.xml
deleted file mode 100644
index 0ab3c103149..00000000000
--- a/auto_backup/backup_data.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/auto_backup/bkp_conf_view.xml b/auto_backup/bkp_conf_view.xml
deleted file mode 100644
index 27e56937e61..00000000000
--- a/auto_backup/bkp_conf_view.xml
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-
-
- Configure Backup
- db.backup
- form
-
-
-
-
-
-
- Configure Backup
- db.backup
- tree
-
-
-
-
-
-
-
-
-
-
-
-
-
- Configure Backup
- db.backup
- search
-
-
-
-
-
-
-
-
-
-
-
-
-
- Configure Backup
- db.backup
- form
- tree,form
-
-
-
-
-
\ No newline at end of file
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index 0c3983e0ed8..2c719ddcdeb 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -244,9 +244,6 @@ def schedule_backup(self, cr, user, context={}):
tools.config['admin_passwd'],
rec.name)
except:
-<<<<<<< HEAD
- logger.notifyChannel('backup', netsvc.LOG_INFO, "Could'nt backup database %s. Bad database administrator password for server running at http://%s:%s" %(rec.name, rec.host, rec.port))
-=======
_logger.notifyChannel(
'backup', netsvc.LOG_INFO,
_(
@@ -254,7 +251,6 @@ def schedule_backup(self, cr, user, context={}):
"Bad database administrator"
"password for server running at http://%s:%s"
) % (rec.name, rec.host, rec.port))
->>>>>>> f331fab... [FIX] bug logger --> _logger call
continue
bkp = base64.decodestring(bkp)
fp = open(file_path, 'wb')
@@ -400,8 +396,4 @@ def schedule_backup(self, cr, user, context={}):
db_backup()
-<<<<<<< HEAD
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-=======
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
->>>>>>> f331fab... [FIX] bug logger --> _logger call
From fcc185e2bacec88cae6fead050f8bace50bf61ae Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 21 Jul 2015 10:17:56 +0200
Subject: [PATCH 15/74] [RM] description index.html
---
auto_backup/static/description/index.html | 100 ----------------------
1 file changed, 100 deletions(-)
delete mode 100644 auto_backup/static/description/index.html
diff --git a/auto_backup/static/description/index.html b/auto_backup/static/description/index.html
deleted file mode 100644
index 6b3ba3e2b6d..00000000000
--- a/auto_backup/static/description/index.html
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-
-
Automated backups
-
A tool for all your back-ups, internal and external!
-
-
-
-
-
-
-
-
- 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!
-
- 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 a path and everything will be backed up automatically. This is done through an SSH (encrypted) tunnel, thanks to pysftp, so your data is safe!
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Test connection
-
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 SFTP Connection' button and you will get message telling you if everything is OK, or what is wrong!
-
-
-
-
-
-
-
-
E-mail on backup failure
-
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.
-
The backup for the server ${object.host} (IP: ${object.sftpip}) failed.
+
Please check the following details:
+
IP address SFTP server: ${object.sftpip}
+
Username: ${object.sftpusername}
+
Password: ${object.sftppassword}
+
Error details: ${object.lasterrorlog}
+
With kind regards
+
+ ]]>
+
+
+
+
\ No newline at end of file
diff --git a/auto_backup/i18n/it.po b/auto_backup/i18n/it.po
new file mode 100644
index 00000000000..5137ea788f3
--- /dev/null
+++ b/auto_backup/i18n/it.po
@@ -0,0 +1,363 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * auto_backup
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-07-21 13:00+0000\n"
+"PO-Revision-Date: 2015-07-21 13:00+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: auto_backup
+#: model:email.template,body_html:auto_backup.email_template_autobackup_error_noificaiton
+msgid "\n"
+" \n"
+"
Dear,
\n"
+"\n"
+"
The backup for the server ${object.host} (IP: ${object.sftpip}) failed.
\n"
+"
Please check the following details:
\n"
+"
IP address SFTP server: ${object.sftpip}
\n"
+"
Username: ${object.sftpusername}
\n"
+"
Password: ${object.sftppassword}
\n"
+"
Error details: ${object.lasterrorlog}
\n"
+"
With kind regards
\n"
+"\n"
+" "
+msgstr "\n"
+" \n"
+"
Buongiorno,
\n"
+"\n"
+"
Il backup del DB del server ${object.host} (IP: ${object.sftpip}) e' fallito.
\n"
+"
Si prega di controllare le seguenti impostazioni:
\n"
+"
Indirizzo IP server SFTP: ${object.sftpip}
\n"
+"
Username: ${object.sftpusername}
\n"
+"
Password: ${object.sftppassword}
\n"
+"
Dettaglio errore: ${object.lasterrorlog}
\n"
+"
Cordiali Saluti
\n"
+"\n"
+" "
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:204
+#, python-format
+msgid "\n"
+"Your IP address seems to be too short.\n"
+""
+msgstr "\n"
+"L' indirizzo IP sembra essere troppo corto.\n"
+""
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:209
+#, python-format
+msgid "%s"
+msgstr "%s"
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:288
+#, python-format
+msgid "(Part of the) path didn't exist. Creating it now at %s"
+msgstr "(Una parte del) path non esiste. Verra' creato in %s"
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr "Percorso assoluto per il salvataggio del DB"
+
+#. module: auto_backup
+#: field:db.backup,sendmailsftpfail:0
+msgid "Auto. E-mail on backup fail"
+msgstr "Auto. E-mail nel caso di errori durante il backup "
+
+#. module: auto_backup
+#: field:db.backup,autoremove:0
+msgid "Auto. Remove Backups"
+msgstr "Rimuovi Backups"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Automatic backups of the database can be scheduled as follows:"
+msgstr "Il backup automatico del DB e' pianificato come segue:"
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr "Backup Directory"
+
+#. module: auto_backup
+#: model:email.template,subject:auto_backup.email_template_autobackup_error_noificaiton
+msgid "Backup from ${object.host} - (${object.sftpip}) failed"
+msgstr "Backup da ${object.host} - (${object.sftpip}) fallito"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_tree
+msgid "Backups"
+msgstr "Backups"
+
+#. module: auto_backup
+#: help:db.backup,daystokeepsftp:0
+msgid "Choose after how many days the backup should be deleted from the FTP server. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days from the FTP server."
+msgstr "Scegliere dopo quanti giorni si possa condsiderare da eliminare, un Backup nel server FTP. Per esempio:\n"
+"se si imposta 5 i files di backups piu' vecchi di 5 giorni saranno eliminati dal server FTP"
+
+#. module: auto_backup
+#: help:db.backup,daystokeep:0
+msgid "Scegliere dopo quanti giorni si possa condsiderare da eliminare un Backup. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days."
+msgstr "Choose after how many days the backup should be deleted. For example:\n"
+"se si imposta 5 i files di backups piu' vecchi di 5 giorni saranno eliminati."
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr "Configura Backup"
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:202
+#, python-format
+msgid "Connection Test Failed!"
+msgstr "Test connessione Fallito!"
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:198
+#, python-format
+msgid "Connection Test Succeeded!"
+msgstr "Test connessione avvenuto con successo!"
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:241
+#, python-format
+msgid "Couldn't backup database %s. Bad database administratorpassword for server running at http://%s:%s"
+msgstr "Impossibile eseguire il backup di %s. DB password erraata per il server http://%s:%s"
+
+#. module: auto_backup
+#: field:db.backup,create_uid:0
+msgid "Created by"
+msgstr "Created by"
+
+#. module: auto_backup
+#: field:db.backup,create_date:0
+msgid "Created on"
+msgstr "Created on"
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr "Database"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr "Database you want to schedule backups for"
+
+#. module: auto_backup
+#: field:db.backup,emailtonotify:0
+#: field:db.backup,lasterrorlog:0
+msgid "E-mail to notify"
+msgstr "E-mail di notifica"
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:176
+#, python-format
+msgid "Error"
+msgstr "Errore"
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:176
+#, python-format
+msgid "Error ! No such database exists!"
+msgstr "Errore ! Il DB non esiste!"
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:199
+#, python-format
+msgid "Everything seems properly set up for FTP back-ups!"
+msgstr "Tutto sembra impostato correttamente per il back-up FTP!"
+
+#. module: auto_backup
+#: help:db.backup,emailtonotify:0
+#: help:db.backup,lasterrorlog:0
+msgid "Fill in the e-mail where you want to be notified that the backup failed on the FTP."
+msgstr "Compilare l'e -mail in cui si desidera essere avvisati,se il backup FTP fallisce."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "For example: /odoo/backups/"
+msgstr "Es.: /odoo/backups/"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Go to Settings / Technical / Automation / Scheduled Actions."
+msgstr "Anadare in Settings / Technical / Automation / Scheduled Actions."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Help"
+msgstr "Aiuto"
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr "Host"
+
+#. module: auto_backup
+#: field:db.backup,id:0
+msgid "ID"
+msgstr "ID"
+
+#. module: auto_backup
+#: field:db.backup,sftpip:0
+msgid "IP Address SFTP Server"
+msgstr "IP Address SFTP Server"
+
+#. module: auto_backup
+#: help:db.backup,sendmailsftpfail:0
+msgid "If you check this option you can choose to automaticly get e-mailed when the backup to the external server failed."
+msgstr "Se si seleziona questa opzione è possibile scegliere di essere notificati automaticamente via e-mail quando il backup al server esterno fallisce ."
+
+#. module: auto_backup
+#: help:db.backup,autoremove:0
+msgid "If you check this option you can choose to automaticly remove the backup after xx days"
+msgstr "Se si seleziona questa opzione è possibile scegliere di rimuovere automaticamente il backup dopo xx giorni"
+
+#. module: auto_backup
+#: help:db.backup,sftpwrite:0
+msgid "If you check this option you can specify the details needed to write to a remote server with SFTP."
+msgstr "Se si seleziona questa opzione è possibile specificare i dettagli necessari per scrivere a un server remoto con SFTP ."
+
+#. module: auto_backup
+#: field:db.backup,write_uid:0
+msgid "Last Updated by"
+msgstr "Last Updated by"
+
+#. module: auto_backup
+#: field:db.backup,write_date:0
+msgid "Last Updated on"
+msgstr "Last Updated on"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Local backup configuration"
+msgstr "Configurazione backup locale"
+
+#. module: auto_backup
+#: field:db.backup,sftppassword:0
+msgid "Password User SFTP Server"
+msgstr "Password utene SFTP Server"
+
+#. module: auto_backup
+#: field:db.backup,sftppath:0
+msgid "Path external server"
+msgstr "Path server esterno"
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr "Porta"
+
+#. module: auto_backup
+#: field:db.backup,daystokeepsftp:0
+msgid "Remove SFTP after x days"
+msgstr "Rimuovi backup da SFTP dopo x giorni"
+
+#. module: auto_backup
+#: field:db.backup,daystokeep:0
+msgid "Remove after x days"
+msgstr "Rimuovi dopo x giorni"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "SFTP"
+msgstr "SFTP"
+
+#. module: auto_backup
+#: field:db.backup,sftpport:0
+msgid "SFTP Port"
+msgstr "Porta SFTP"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_search
+msgid "Search options"
+msgstr "Search options"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Search the action named 'Backup scheduler'."
+msgstr "Cerca l'azione denominata ' di pianificazione del backup ' ."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Set the scheduler to active and fill in how often you want backups generated."
+msgstr "Impostare lo scheduler per attivare e compilare la frequenza con cui si desidera generare il backup."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test"
+msgstr "Test"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test SFTP Connection"
+msgstr "Test SFTP Connection"
+
+#. module: auto_backup
+#: help:db.backup,sftpip:0
+msgid "The IP address from your remote server. For example 192.168.0.1"
+msgstr "Indirizzo IP server remoto. Es. 192.168.0.1"
+
+#. module: auto_backup
+#: help:db.backup,sftppath:0
+msgid "The location to the folder where the dumps should be written to. For example /odoo/backups/.\n"
+"Files will then be written to /odoo/backups/ on your remote server."
+msgstr "La posizione della cartella in cui i dumps devono essere scritti. Es. /odoo/backups/.\n"
+"i files verranno scritti su /odoo/backups/ nel server remoto."
+
+#. module: auto_backup
+#: help:db.backup,sftppassword:0
+msgid "The password from the user where the SFTP connection should be made with. This is the password from the user on the external server."
+msgstr "La password dell'utente con cui la connessione SFTP deve essere fatta. Questa è la password dall'utente sul server esterno ."
+
+#. module: auto_backup
+#: help:db.backup,sftpport:0
+msgid "The port on the FTP server that accepts SSH/SFTP calls."
+msgstr "La porta sul server FTP che accetta chiamate SSH / SFTP."
+
+#. module: auto_backup
+#: help:db.backup,sftpusername:0
+msgid "The username where the SFTP connection should be made with. This is the user on the external server."
+msgstr "Il nome utente in cui la connessione SFTP dovrebbe essere fatto con . Questo è l'utente sul server esterno."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
+msgstr "pianificazione per il backup automatico del database in esecuzione su dato host /porta ad intervalli regolari."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Use SFTP with caution! This writes files to external servers under the path you specify."
+msgstr "Usare SFTP con cautela ! Questo scrive file su server esterni nel percorso specificato "
+
+#. module: auto_backup
+#: field:db.backup,sftpusername:0
+msgid "Username SFTP Server"
+msgstr "Username SFTP Server"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Warning:"
+msgstr "Warning:"
+
+#. module: auto_backup
+#: field:db.backup,sftpwrite:0
+msgid "Write to external server with sftp"
+msgstr "Salva il backup anche su server FTP esterno"
+
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index 2c719ddcdeb..96ed67072e6 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -2,7 +2,7 @@
##############################################################################
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
-# $Id$
+# Copyright 2015 Agile Business Group
#
# 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
@@ -33,9 +33,10 @@
'through SFTP.Please install pysftp on your system.'
'(sudo pip install pysftp)'
)
-from openerp.osv import fields, osv
+from openerp import models, fields, api, _
+from openerp.exceptions import except_orm, Warning
from openerp import tools
-from openerp import netsvc, _
+from openerp import netsvc
import logging
_logger = logging.getLogger(__name__)
@@ -48,142 +49,146 @@ def execute(connector, method, *args):
raise e
return res
-addons_path = tools.config['addons_path'] + '/auto_backup/DBbackups'
-
-class db_backup(osv.Model):
+class db_backup(models.Model):
_name = 'db.backup'
- def get_db_list(self, cr, user, ids, host, port, context={}):
- print("Host: " + host)
- print("Port: " + port)
- uri = 'http://' + host + ':' + port
- conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/db')
+ def get_connection(self, host, port):
+ uri = 'http://%s:%s' % (host, port)
+ return xmlrpclib.ServerProxy(uri + '/xmlrpc/db')
+
+ def get_db_list(self, host, port):
+ conn = self.get_connection(host, port)
db_list = execute(conn, 'list')
return db_list
- def _get_db_name(self, cr, uid, vals, context=None):
- # attach_pool = self.pool.get("ir.logging")
- dbName = cr.dbname
- return dbName
+ @api.model
+ def _get_db_name(self):
+ return self.env.cr.dbname
- _columns = {
- # Columns local server
- 'host': fields.char('Host', size=100, required='True'),
- 'port': fields.char('Port', size=10, required='True'),
- 'name': fields.char(
- 'Database', size=100, required='True',
- help='Database you want to schedule backups for'
- ),
- 'bkp_dir': fields.char(
- 'Backup Directory', size=100,
- help='Absolute path for storing the backups',
- required='True'
- ),
- 'autoremove': fields.boolean(
- 'Auto. Remove Backups',
- help=(
- "If you check this option you can choose to "
- "automaticly remove the backup after xx days"
- )
- ),
- 'daystokeep': fields.integer(
- 'Remove after x days',
- help=(
- "Choose after how many days the backup should be "
- "deleted. For example:\nIf you fill in 5 the backups "
- "will be removed after 5 days."
- ), required=True
- ),
- # Columns for external server (SFTP)
- 'sftpwrite': fields.boolean(
- 'Write to external server with sftp',
- help=(
- "If you check this option you can specify the details "
- "needed to write to a remote server with SFTP."
- )
- ),
- 'sftppath': fields.char(
- 'Path external server',
- help=(
- "The location to the folder where the dumps should be "
- "written to. For example /odoo/backups/.\nFiles will then"
- " be written to /odoo/backups/ on your remote server."
- )
- ),
- 'sftpip': fields.char(
- 'IP Address SFTP Server',
- help=(
- "The IP address from your remote"
- " server. For example 192.168.0.1"
- )
- ),
- 'sftpport': fields.integer(
- "SFTP Port",
- help="The port on the FTP server that accepts SSH/SFTP calls."
- ),
- 'sftpusername': fields.char(
- 'Username SFTP Server',
- help=(
- "The username where the SFTP connection "
- "should be made with. This is the user on the external server."
- )
- ),
- 'sftppassword': fields.char(
- 'Password User SFTP Server',
- help=(
- "The password from the user where the SFTP connection "
- "should be made with. This is the password from the user"
- " on the external server."
- )
- ),
- 'daystokeepsftp': fields.integer(
- 'Remove SFTP after x days',
- help=(
- "Choose after how many days the backup should be deleted "
- "from the FTP server. For example:\nIf you fill in 5 the "
- "backups will be removed after 5 days from the FTP server."
- )
- ),
- 'sendmailsftpfail': fields.boolean(
- 'Auto. E-mail on backup fail', help=(
- "If you check this option you can choose to automaticly"
- " get e-mailed when the backup to the external server failed."
- )
- ),
- 'emailtonotify': fields.char(
- 'E-mail to notify',
- help=(
- "Fill in the e-mail where you want to be"
- " notified that the backup failed on the FTP."
- )
- ),
- }
-
- _defaults = {
- # 'bkp_dir' : lambda *a : addons_path,
- 'bkp_dir': '/odoo/backups',
- 'host': 'localhost',
- 'port': '8069',
- 'name': _get_db_name,
- 'daystokeepsftp': 30,
- 'sftpport': 22,
- }
+ # Columns local server
+ host = fields.Char(
+ string='Host', default='localhost', size=100, required=True)
+ port = fields.Char(
+ string='Port', default='8069', size=10, required=True)
+ name = fields.Char(
+ string='Database', size=100, required=True,
+ default=_get_db_name,
+ help='Database you want to schedule backups for'
+ )
+ bkp_dir = fields.Char(
+ string='Backup Directory', size=100,
+ default='/odoo/backups',
+ help='Absolute path for storing the backups',
+ required=True
+ )
+ autoremove = fields.Boolean(
+ string='Auto. Remove Backups',
+ help=(
+ "If you check this option you can choose to "
+ "automaticly remove the backup after xx days"
+ )
+ )
+ daystokeep = fields.Integer(
+ string='Remove after x days',
+ default=30,
+ help=(
+ "Choose after how many days the backup should be "
+ "deleted. For example:\nIf you fill in 5 the backups "
+ "will be removed after 5 days."
+ ), required=True
+ )
+ sftpwrite = fields.Boolean(
+ string='Write to external server with sftp',
+ help=(
+ "If you check this option you can specify the details "
+ "needed to write to a remote server with SFTP."
+ )
+ )
+ sftppath = fields.Char(
+ string='Path external server',
+ help=(
+ "The location to the folder where the dumps should be "
+ "written to. For example /odoo/backups/.\nFiles will then"
+ " be written to /odoo/backups/ on your remote server."
+ )
+ )
+ sftpip = fields.Char(
+ string='IP Address SFTP Server',
+ help=(
+ "The IP address from your remote"
+ " server. For example 192.168.0.1"
+ )
+ )
+ sftpport = fields.Integer(
+ string="SFTP Port",
+ default=22,
+ help="The port on the FTP server that accepts SSH/SFTP calls."
+ )
+ sftpusername = fields.Char(
+ string='Username SFTP Server',
+ help=(
+ "The username where the SFTP connection "
+ "should be made with. This is the user on the external server."
+ )
+ )
+ sftppassword = fields.Char(
+ string='Password User SFTP Server',
+ help=(
+ "The password from the user where the SFTP connection "
+ "should be made with. This is the password from the user"
+ " on the external server."
+ )
+ )
+ daystokeepsftp = fields.Integer(
+ string='Remove SFTP after x days',
+ default=30,
+ help=(
+ "Choose after how many days the backup should be deleted "
+ "from the FTP server. For example:\nIf you fill in 5 the "
+ "backups will be removed after 5 days from the FTP server."
+ )
+ )
+ sendmailsftpfail = fields.Boolean(
+ string='Auto. E-mail on backup fail',
+ help=(
+ "If you check this option you can choose to automaticly"
+ " get e-mailed when the backup to the external server failed."
+ )
+ )
+ emailtonotify = fields.Char(
+ string='E-mail to notify',
+ help=(
+ "Fill in the e-mail where you want to be"
+ " notified that the backup failed on the FTP."
+ )
+ )
+ lasterrorlog = fields.Text(
+ string='E-mail to notify',
+ help=(
+ "Fill in the e-mail where you want to be"
+ " notified that the backup failed on the FTP."
+ )
+ )
- def _check_db_exist(self, cr, user, ids):
- for rec in self.browse(cr, user, ids):
- db_list = self.get_db_list(cr, user, ids, rec.host, rec.port)
+ @api.multi
+ def _check_db_exist(self):
+ for rec in self:
+ db_list = self.get_db_list(rec.host, rec.port)
if rec.name in db_list:
return True
- return False
+ return False
_constraints = [
- (_check_db_exist, _('Error ! No such database exists!'), [])
+ (
+ _check_db_exist,
+ _('Error ! No such database exists!'), ['name']
+ )
]
- def test_sftp_connection(self, cr, uid, ids, context=None):
- conf_ids = self.search(cr, uid, [])
- confs = self.browse(cr, uid, conf_ids)
+ @api.multi
+ def test_sftp_connection(self):
+ confs = self.search([])
# Check if there is a success or fail and write messages
messageTitle = ""
messageContent = ""
@@ -211,38 +216,35 @@ def test_sftp_connection(self, cr, uid, ids, context=None):
"\nYour IP address seems to be too short.\n")
messageContent += "Here is what we got instead:\n"
if "Failed" in messageTitle:
- raise osv.except_osv(
+ raise except_orm(
_(messageTitle), _(
messageContent + "%s") %
tools.ustr(e))
else:
- raise osv.except_osv(_(messageTitle), _(messageContent))
+ raise Warning(_(messageTitle), _(messageContent))
- def schedule_backup(self, cr, user, context={}):
- conf_ids = self.search(cr, user, [])
- confs = self.browse(cr, user, conf_ids)
- for rec in confs:
- db_list = self.get_db_list(cr, user, [], rec.host, rec.port)
+ @api.model
+ def schedule_backup(self):
+ for rec in self.search([]):
+ db_list = self.get_db_list(rec.host, rec.port)
if rec.name in db_list:
+ file_path = ''
+ bkp_file = ''
try:
if not os.path.isdir(rec.bkp_dir):
os.makedirs(rec.bkp_dir)
except:
raise
# Create name for dumpfile.
- bkp_file = '%s_%s.dump' % (
+ bkp_file = '%s_%s.dimp.zip' % (
time.strftime('%d_%m_%Y_%H_%M_%S'),
rec.name)
file_path = os.path.join(rec.bkp_dir, bkp_file)
- uri = 'http://' + rec.host + ':' + rec.port
- conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/db')
+ conn = self.get_connection(rec.host, rec.port)
bkp = ''
try:
bkp = execute(
- conn,
- 'dump',
- tools.config['admin_passwd'],
- rec.name)
+ conn, 'dump', tools.config['admin_passwd'], rec.name)
except:
_logger.notifyChannel(
'backup', netsvc.LOG_INFO,
@@ -251,7 +253,7 @@ def schedule_backup(self, cr, user, context={}):
"Bad database administrator"
"password for server running at http://%s:%s"
) % (rec.name, rec.host, rec.port))
- continue
+ return False
bkp = base64.decodestring(bkp)
fp = open(file_path, 'wb')
fp.write(bkp)
@@ -261,7 +263,7 @@ def schedule_backup(self, cr, user, context={}):
'backup', netsvc.LOG_INFO,
"database %s doesn't exist on http://%s:%s" %
(rec.name, rec.host, rec.port))
-
+ return False
# Check if user wants to write to SFTP or not.
if rec.sftpwrite is True:
try:
@@ -282,7 +284,6 @@ def schedule_backup(self, cr, user, context={}):
# user made a typo in his path with multiple slashes
# (/odoo//backups/) it will be fixed by this regex.
pathToWriteTo = re.sub('([/]{2,5})+', '/', pathToWriteTo)
- print(pathToWriteTo)
try:
srv.chdir(pathToWriteTo)
except IOError:
@@ -308,7 +309,6 @@ def schedule_backup(self, cr, user, context={}):
for f in os.listdir(dir):
fullpath = os.path.join(dir, f)
if os.path.isfile(fullpath):
- print(fullpath)
srv.put(fullpath)
# Navigate in to the correct folder.
@@ -319,19 +319,23 @@ def schedule_backup(self, cr, user, context={}):
for file in srv.listdir(pathToWriteTo):
# Get the full path
fullpath = os.path.join(pathToWriteTo, file)
- # Get the timestamp from the file on the external
- # server
- timestamp = srv.stat(fullpath).st_atime
- createtime = datetime.datetime.fromtimestamp(timestamp)
- now = datetime.datetime.now()
- delta = now - createtime
- # If the file is older than the daystokeepsftp (the
- # days to keep that the user filled in on the Odoo form
- # it will be removed.
- if delta.days >= rec.daystokeepsftp:
- # Only delete files, no directories!
- if srv.isfile(fullpath) and ".dump" in file:
- print("Delete: " + file)
+ if srv.isfile(fullpath) and ".dump.zip" in file:
+ # Get the timestamp from the file on the external
+ # server
+ timestamp = srv.stat(fullpath).st_atime
+ createtime = (
+ datetime.datetime.fromtimestamp(timestamp)
+ )
+ now = datetime.datetime.now()
+ delta = now - createtime
+ # If the file is older than the daystokeepsftp (the
+ # days to keep that the user filled in on the Odoo
+ # form it will be removed.
+ if (
+ rec.daystokeepsftp > 0 and
+ delta.days >= rec.daystokeepsftp
+ ):
+ # Only delete files, no directories!
srv.unlink(file)
# Close the SFTP session.
srv.close()
@@ -345,25 +349,13 @@ def schedule_backup(self, cr, user, context={}):
# an e-mail notification about this.
if rec.sendmailsftpfail:
try:
- ir_mail_server = self.pool.get('ir.mail_server')
- message = (
- "Dear,\n\nThe backup for the server %s"
- " (IP: %s) failed.Please check"
- " the following details:\n\n"
- "IP address SFTP server: %s \nUsername: %s"
- "\nPassword: %s"
- "\n\nError details: %s \n\nWith kind regards"
- ) % (
- rec.host, rec.sftpip, rec.sftpip,
- rec.sftpusername, rec.sftppassword,
- tools.ustr(e)
+ self.write({'lasterrorlog': tools.ustr(e)})
+ abk_template = self.env.ref(
+ 'auto_backup.'
+ 'email_template_autobackup_error_noificaiton',
+ False
)
- msg = ir_mail_server.build_email(
- "auto_backup@" + rec.name + ".com",
- [rec.emailtonotify],
- "Backup from " + rec.host + "(" + rec.sftpip +
- ") failed", message)
- ir_mail_server.send_email(cr, user, msg)
+ abk_template.send_mail(self.id)
except Exception:
pass
@@ -383,17 +375,16 @@ def schedule_backup(self, cr, user, context={}):
dir = rec.bkp_dir
# Loop over all files in the directory.
for f in os.listdir(dir):
- fullpath = os.path.join(dir, f)
- timestamp = os.stat(fullpath).st_ctime
- createtime = datetime.datetime.fromtimestamp(timestamp)
- now = datetime.datetime.now()
- delta = now - createtime
- if delta.days >= rec.daystokeep:
- # Only delete files (which are .dump), no directories.
- if os.path.isfile(fullpath) and ".dump" in f:
- print("Delete: " + fullpath)
+ if os.path.isfile(fullpath) and ".dump.zip" in f:
+ fullpath = os.path.join(dir, f)
+ timestamp = os.stat(fullpath).st_ctime
+ createtime = (
+ datetime.datetime.fromtimestamp(timestamp)
+ )
+ now = datetime.datetime.now()
+ delta = now - createtime
+ if delta.days >= rec.daystokeep:
os.remove(fullpath)
-
-db_backup()
+ return True
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/auto_backup/security/ir.model.access.csv b/auto_backup/security/ir.model.access.csv
new file mode 100644
index 00000000000..f5de02b31b3
--- /dev/null
+++ b/auto_backup/security/ir.model.access.csv
@@ -0,0 +1,2 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_db_backup,access_db_backup,model_db_backup,,1,0,0,0
\ No newline at end of file
diff --git a/auto_backup/tests/__init__.py b/auto_backup/tests/__init__.py
new file mode 100644
index 00000000000..b35cb66530a
--- /dev/null
+++ b/auto_backup/tests/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright 2015 Agile Business Group
+# Copyright (C) 2015 Alessio Gerace
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from . import test_auto_backup
\ No newline at end of file
diff --git a/auto_backup/tests/test_auto_backup.py b/auto_backup/tests/test_auto_backup.py
new file mode 100644
index 00000000000..a94b4058496
--- /dev/null
+++ b/auto_backup/tests/test_auto_backup.py
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright 2015 Agile Business Group
+# Copyright (C) 2015 Alessio Gerace
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import base64
+from openerp.tests import common
+from openerp.exceptions import except_orm, Warning
+from openerp.modules.module import get_module_resource
+import os
+import time
+from datetime import datetime, date, timedelta
+
+class TestsAutoBackup(common.TransactionCase):
+
+ def setUp(self):
+ super(TestsAutoBackup, self).setUp()
+ self.abk_model = self.env["db.backup"]
+ self.cron_model = self.env["ir.cron"]
+
+
+ def test_0(self):
+ with self.assertRaises(except_orm):
+ self.abk_model.create({'name': 'abcd'})
+
+ def test_1(self):
+ this = self.abk_model.create(
+ {
+ 'bkp_dir': '/tmp'
+ }
+ )
+ self.assertEqual(this.host, 'localhost')
+ cronbk = self.cron_model.search([('name', '=', 'Backup scheduler')])
+ import pdb;pdb.set_trace()
+ cronbk.write(
+ {
+ 'active': True,
+ 'doall': True
+ }
+ )
+ filetime = (
+ datetime.now() + timedelta(minutes=1)
+ ).strftime('%d_%m_%Y_%H_%M_%S')
+
+ bkp_file = '%s_%s.dimp.zip' % (
+ filetime, this.name)
+ file_path = os.path.join(this.bkp_dir, bkp_file)
+ self.assertEqual(os.path.isfile(file_path), True)
From ad3cb507c8daa50c986f5e0ddc90fc48fdfd041c Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 21 Jul 2015 18:30:07 +0200
Subject: [PATCH 17/74] [FIX] test
---
auto_backup/__openerp__.py | 4 +---
auto_backup/tests/test_auto_backup.py | 16 ----------------
2 files changed, 1 insertion(+), 19 deletions(-)
diff --git a/auto_backup/__openerp__.py b/auto_backup/__openerp__.py
index e51b28e38d0..6c5f5bad0a3 100644
--- a/auto_backup/__openerp__.py
+++ b/auto_backup/__openerp__.py
@@ -31,9 +31,7 @@
"category" : "Tools",
"summary": "Backups data base",
"depends" : ['base','email_template'],
- "demo_xml" : [
- "data/backup_data.xml"
- ],
+ "demo" : [],
"data" : [
"view/bkp_conf_view.xml",
"data/backup_data.xml",
diff --git a/auto_backup/tests/test_auto_backup.py b/auto_backup/tests/test_auto_backup.py
index a94b4058496..8e61f6f0ee5 100644
--- a/auto_backup/tests/test_auto_backup.py
+++ b/auto_backup/tests/test_auto_backup.py
@@ -46,19 +46,3 @@ def test_1(self):
}
)
self.assertEqual(this.host, 'localhost')
- cronbk = self.cron_model.search([('name', '=', 'Backup scheduler')])
- import pdb;pdb.set_trace()
- cronbk.write(
- {
- 'active': True,
- 'doall': True
- }
- )
- filetime = (
- datetime.now() + timedelta(minutes=1)
- ).strftime('%d_%m_%Y_%H_%M_%S')
-
- bkp_file = '%s_%s.dimp.zip' % (
- filetime, this.name)
- file_path = os.path.join(this.bkp_dir, bkp_file)
- self.assertEqual(os.path.isfile(file_path), True)
From ef99dd58266ec42dcc67cc1f9d7f6ef914542c19 Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 21 Jul 2015 18:32:20 +0200
Subject: [PATCH 18/74] [FIX] flake8
---
auto_backup/tests/test_auto_backup.py | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/auto_backup/tests/test_auto_backup.py b/auto_backup/tests/test_auto_backup.py
index 8e61f6f0ee5..4f7e08c8cae 100644
--- a/auto_backup/tests/test_auto_backup.py
+++ b/auto_backup/tests/test_auto_backup.py
@@ -19,13 +19,10 @@
#
##############################################################################
-import base64
+
from openerp.tests import common
-from openerp.exceptions import except_orm, Warning
-from openerp.modules.module import get_module_resource
-import os
-import time
-from datetime import datetime, date, timedelta
+from openerp.exceptions import except_orm
+
class TestsAutoBackup(common.TransactionCase):
@@ -34,7 +31,6 @@ def setUp(self):
self.abk_model = self.env["db.backup"]
self.cron_model = self.env["ir.cron"]
-
def test_0(self):
with self.assertRaises(except_orm):
self.abk_model.create({'name': 'abcd'})
From 03af923c429fac200ef1a7055b2e11924638c558 Mon Sep 17 00:00:00 2001
From: archetipo
Date: Wed, 22 Jul 2015 09:29:59 +0200
Subject: [PATCH 19/74] [IMP] deps in travis.yml [FIX] flake8
---
.travis.yml | 3 ++-
auto_backup/__openerp__.py | 16 ++++++++--------
auto_backup/tests/test_auto_backup.py | 1 -
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index ca96d060fe6..bb91c128678 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,7 +22,7 @@ env:
- TRANSIFEX="1"
- TESTS="1" ODOO_REPO="odoo/odoo"
- TESTS="1" ODOO_REPO="OCA/OCB"
- - UNIT_TEST="1"
+ - UNIT_TEST="1"
virtualenv:
system_site_packages: true
@@ -34,6 +34,7 @@ install:
- pip install python-ldap
- pip install unidecode
- pip install validate_email
+ - pip install pysftp
- printf '[options]\n\nrunning_env = dev' > ${HOME}/.openerp_serverrc
- ln -s server_environment_files_sample ./server_environment_files
script:
diff --git a/auto_backup/__openerp__.py b/auto_backup/__openerp__.py
index 6c5f5bad0a3..751c7d296f0 100644
--- a/auto_backup/__openerp__.py
+++ b/auto_backup/__openerp__.py
@@ -21,18 +21,18 @@
##############################################################################
{
- "name" : "Database Auto-Backup",
- "version" : "1.0",
- "author" :(
+ "name": "Database Auto-Backup",
+ "version": "1.0",
+ "author": (
"VanRoey.be - Yenthe Van Ginneken, Agile Business Group,"
" Odoo Community Association (OCA)"
),
- "website" : "http://www.vanroey.be/applications/bedrijfsbeheer/odoo",
- "category" : "Tools",
+ "website": "http://www.vanroey.be/applications/bedrijfsbeheer/odoo",
+ "category": "Tools",
"summary": "Backups data base",
- "depends" : ['base','email_template'],
- "demo" : [],
- "data" : [
+ "depends": ['base', 'email_template'],
+ "demo": [],
+ "data": [
"view/bkp_conf_view.xml",
"data/backup_data.xml",
"data/autobackup_mail_template.xml",
diff --git a/auto_backup/tests/test_auto_backup.py b/auto_backup/tests/test_auto_backup.py
index 4f7e08c8cae..a383143a0af 100644
--- a/auto_backup/tests/test_auto_backup.py
+++ b/auto_backup/tests/test_auto_backup.py
@@ -19,7 +19,6 @@
#
##############################################################################
-
from openerp.tests import common
from openerp.exceptions import except_orm
From cf0cdf86440d4b8468212dd47cef1d89e03350a5 Mon Sep 17 00:00:00 2001
From: archetipo
Date: Wed, 22 Jul 2015 16:08:16 +0200
Subject: [PATCH 20/74] [FIX] flake8 and pylint
---
auto_backup/model/backup_scheduler.py | 24 ++++++++++++------------
auto_backup/tests/__init__.py | 2 +-
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index 96ed67072e6..262d56fd260 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -359,18 +359,18 @@ def schedule_backup(self):
except Exception:
pass
- """Remove all old files (on local server) in case this is configured..
- This is done after the SFTP writing to prevent unusual behaviour:
- If the user would set local back-ups to be kept 0 days and the SFTP
- to keep backups xx days there wouldn't be any new back-ups added
- to the SFTP.
- If we'd remove the dump files before they're writen to the SFTP
- there willbe nothing to write. Meaning that if an user doesn't want
- to keep back-ups locally and only wants them on the SFTP
- (NAS for example) there wouldn't be any writing to the
- remote server if this if statement was before the SFTP write method
- right above this comment.
- """
+ # Remove all old files (on local server) in case this is configured..
+ # This is done after the SFTP writing to prevent unusual behaviour:
+ # If the user would set local back-ups to be kept 0 days and the SFTP
+ # to keep backups xx days there wouldn't be any new back-ups added
+ # to the SFTP.
+ # If we'd remove the dump files before they're writen to the SFTP
+ # there willbe nothing to write. Meaning that if an user doesn't want
+ # to keep back-ups locally and only wants them on the SFTP
+ # (NAS for example) there wouldn't be any writing to the
+ # remote server if this if statement was before the SFTP write method
+ # right above this comment.
+
if rec.autoremove is True:
dir = rec.bkp_dir
# Loop over all files in the directory.
diff --git a/auto_backup/tests/__init__.py b/auto_backup/tests/__init__.py
index b35cb66530a..01e81ba8a05 100644
--- a/auto_backup/tests/__init__.py
+++ b/auto_backup/tests/__init__.py
@@ -19,4 +19,4 @@
#
##############################################################################
-from . import test_auto_backup
\ No newline at end of file
+from . import test_auto_backup
From f8cd72eb85efc02fa7f2776aa08252c3600481bc Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 28 Jul 2015 10:40:41 +0200
Subject: [PATCH 21/74] [FIX] name of file
---
auto_backup/model/backup_scheduler.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index 262d56fd260..d62b6a3a940 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -236,7 +236,7 @@ def schedule_backup(self):
except:
raise
# Create name for dumpfile.
- bkp_file = '%s_%s.dimp.zip' % (
+ bkp_file = '%s_%s.dump.zip' % (
time.strftime('%d_%m_%Y_%H_%M_%S'),
rec.name)
file_path = os.path.join(rec.bkp_dir, bkp_file)
From 7d107c0fdce7a70752ca8fb9a512e62ffbb3da72 Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 28 Jul 2015 11:07:56 +0200
Subject: [PATCH 22/74] [FIX] autoremove method [FIX] Contributors
---
auto_backup/README.rst | 2 +-
auto_backup/model/backup_scheduler.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/auto_backup/README.rst b/auto_backup/README.rst
index af72d17f3ec..d28db0a525e 100644
--- a/auto_backup/README.rst
+++ b/auto_backup/README.rst
@@ -80,7 +80,7 @@ Credits
Contributors
------------
-* Yenthe Van Ginneken
+* Yenthe Van Ginneken
* Alessio Gerace
Maintainer
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index d62b6a3a940..a836f559cba 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -375,8 +375,8 @@ def schedule_backup(self):
dir = rec.bkp_dir
# Loop over all files in the directory.
for f in os.listdir(dir):
+ fullpath = os.path.join(dir, f)
if os.path.isfile(fullpath) and ".dump.zip" in f:
- fullpath = os.path.join(dir, f)
timestamp = os.stat(fullpath).st_ctime
createtime = (
datetime.datetime.fromtimestamp(timestamp)
From c2a7abc246c4a72fb268b0be5dada0a359a67000 Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 28 Jul 2015 15:13:12 +0200
Subject: [PATCH 23/74] [FIX] mail.tempale seems not work in cron task,
replaced with direct call of mail.mail
---
auto_backup/__openerp__.py | 1 -
auto_backup/data/autobackup_mail_template.xml | 27 --------------
auto_backup/model/backup_scheduler.py | 35 +++++++++++++------
3 files changed, 25 insertions(+), 38 deletions(-)
delete mode 100644 auto_backup/data/autobackup_mail_template.xml
diff --git a/auto_backup/__openerp__.py b/auto_backup/__openerp__.py
index 751c7d296f0..f1b3a2842ec 100644
--- a/auto_backup/__openerp__.py
+++ b/auto_backup/__openerp__.py
@@ -35,7 +35,6 @@
"data": [
"view/bkp_conf_view.xml",
"data/backup_data.xml",
- "data/autobackup_mail_template.xml",
"security/ir.model.access.csv"
],
"active": False,
diff --git a/auto_backup/data/autobackup_mail_template.xml b/auto_backup/data/autobackup_mail_template.xml
deleted file mode 100644
index f3a2d7858b2..00000000000
--- a/auto_backup/data/autobackup_mail_template.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
- Auto Backup Error notification
- auto_backup@${object.name}
- Backup from ${object.host} - (${object.sftpip}) failed
- ${object.emailtonotify}
-
-
- Dear,
-
-
The backup for the server ${object.host} (IP: ${object.sftpip}) failed.
-
Please check the following details:
-
IP address SFTP server: ${object.sftpip}
-
Username: ${object.sftpusername}
-
Password: ${object.sftppassword}
-
Error details: ${object.lasterrorlog}
-
With kind regards
-
- ]]>
-
-
-
-
\ No newline at end of file
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index a836f559cba..f2d5b9c9574 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -225,6 +225,7 @@ def test_sftp_connection(self):
@api.model
def schedule_backup(self):
+
for rec in self.search([]):
db_list = self.get_db_list(rec.host, rec.port)
if rec.name in db_list:
@@ -349,15 +350,31 @@ def schedule_backup(self):
# an e-mail notification about this.
if rec.sendmailsftpfail:
try:
- self.write({'lasterrorlog': tools.ustr(e)})
- abk_template = self.env.ref(
- 'auto_backup.'
- 'email_template_autobackup_error_noificaiton',
- False
+ ir_mail_server = self.env['ir.mail_server']
+ message = (
+ "Dear,\n\nThe backup for the server %s"
+ " (IP: %s) failed.Please check"
+ " the following details:\n\n"
+ "IP address SFTP server: %s \nUsername: %s"
+ "\nPassword: %s"
+ "\n\nError details: %s \n\nWith kind regards"
+ ) % (
+ rec.host, rec.sftpip, rec.sftpip,
+ rec.sftpusername, rec.sftppassword,
+ tools.ustr(e)
+ )
+ msg = ir_mail_server.build_email(
+ "auto_backup@%s.com" % rec.name,
+ [rec.emailtonotify],
+ "Backup from %s ( %s ) failed" % (
+ rec.host, rec.sftpip),
+ message)
+ ir_mail_server.send_email(msg)
+
+ except Exception as e:
+ _logger.debug(
+ 'Exception! %s' % tools.ustr(e)
)
- abk_template.send_mail(self.id)
- except Exception:
- pass
# Remove all old files (on local server) in case this is configured..
# This is done after the SFTP writing to prevent unusual behaviour:
@@ -386,5 +403,3 @@ def schedule_backup(self):
if delta.days >= rec.daystokeep:
os.remove(fullpath)
return True
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
From dd6036006c157e99dd2b09a667dcab1c78b749de Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 28 Jul 2015 15:41:08 +0200
Subject: [PATCH 24/74] [FIX] Readme
---
auto_backup/README.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/auto_backup/README.rst b/auto_backup/README.rst
index d28db0a525e..00aaaa37c9f 100644
--- a/auto_backup/README.rst
+++ b/auto_backup/README.rst
@@ -16,9 +16,9 @@ instal pysftp via pip.
Configuration
=============
-To configure this module, you need to:
-
-* go to ...
+Go to Settings -> Configuration -> Configure Backup
+create your configurations for each database that you needed
+to backups.
Usage
=====
From be7663b860f986080a2e53ba9c19b404cd13be15 Mon Sep 17 00:00:00 2001
From: archetipo
Date: Wed, 2 Sep 2015 08:56:57 +0200
Subject: [PATCH 25/74] [FIX] review remarks
---
auto_backup/i18n/it.po | 28 ------
auto_backup/model/backup_scheduler.py | 132 ++++++++++++++------------
2 files changed, 69 insertions(+), 91 deletions(-)
diff --git a/auto_backup/i18n/it.po b/auto_backup/i18n/it.po
index 5137ea788f3..a12a5cacb74 100644
--- a/auto_backup/i18n/it.po
+++ b/auto_backup/i18n/it.po
@@ -15,34 +15,6 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
-#. module: auto_backup
-#: model:email.template,body_html:auto_backup.email_template_autobackup_error_noificaiton
-msgid "\n"
-" \n"
-"
Dear,
\n"
-"\n"
-"
The backup for the server ${object.host} (IP: ${object.sftpip}) failed.
\n"
-"
Please check the following details:
\n"
-"
IP address SFTP server: ${object.sftpip}
\n"
-"
Username: ${object.sftpusername}
\n"
-"
Password: ${object.sftppassword}
\n"
-"
Error details: ${object.lasterrorlog}
\n"
-"
With kind regards
\n"
-"\n"
-" "
-msgstr "\n"
-" \n"
-"
Buongiorno,
\n"
-"\n"
-"
Il backup del DB del server ${object.host} (IP: ${object.sftpip}) e' fallito.
A tool for all your back-ups, internal and external!
-
-
-
-
-
-
-
-
- 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!
-
- 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 a path and everything will be backed up automatically. This is done through an SSH (encrypted) tunnel, thanks to pysftp, so your data is safe!
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Test connection
-
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 SFTP Connection' button and you will get message telling you if everything is OK, or what is wrong!
-
-
-
-
-
-
-
-
E-mail on backup failure
-
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.
-
-
diff --git a/auto_backup/tests/test_auto_backup.py b/auto_backup/tests/test_auto_backup.py
index e2e6fee4550..a2308914492 100644
--- a/auto_backup/tests/test_auto_backup.py
+++ b/auto_backup/tests/test_auto_backup.py
@@ -19,38 +19,25 @@
#
##############################################################################
-from openerp.tests import common
-from openerp.exceptions import except_orm
import os
-import time
+from datetime import datetime
+from openerp.tests import common
class TestsAutoBackup(common.TransactionCase):
def setUp(self):
super(TestsAutoBackup, self).setUp()
- self.abk_model = self.env["db.backup"]
- self.cron_model = self.env["ir.cron"]
-
- def test_0(self):
- with self.assertRaises(except_orm):
- self.abk_model.create(
- {
- 'name': 'abcd',
- 'adminpassword': 'admin'
- }
- )
-
- def test_1(self):
- this = self.abk_model.create(
+ self.abk = self.env["db.backup"].create(
{
- 'bkp_dir': '/tmp'
+ 'name': u'Têst backup',
}
)
- self.assertEqual(this.bkp_dir, '/tmp')
- bkp_file = '%s_%s.dump.zip' % (
- time.strftime('%d_%m_%Y_%H_%M_%S'),
- this.name)
- file_path = os.path.join(this.bkp_dir, bkp_file)
- this.schedule_backup()
- self.assertTrue(os.path.isfile(file_path))
+
+ def test_local(self):
+ """A local database is backed up."""
+ filename = self.abk.filename(datetime.now())
+ self.abk.action_backup()
+ generated_backup = [f for f in os.listdir(self.abk.folder)
+ if f >= filename]
+ self.assertEqual(len(generated_backup), 1)
diff --git a/auto_backup/view/bkp_conf_view.xml b/auto_backup/view/bkp_conf_view.xml
deleted file mode 100644
index cb2281b088e..00000000000
--- a/auto_backup/view/bkp_conf_view.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-
-
-
- Configure Backup
- db.backup
- form
-
-
-
-
-
-
- Configure Backup
- db.backup
- tree
-
-
-
-
-
-
-
-
-
-
-
- Configure Backup
- db.backup
- search
-
-
-
-
-
-
-
-
-
-
-
- Configure Backup
- db.backup
- form
- tree,form
-
-
-
-
-
-
diff --git a/auto_backup/view/db_backup_view.xml b/auto_backup/view/db_backup_view.xml
new file mode 100644
index 00000000000..bc9ad896a8d
--- /dev/null
+++ b/auto_backup/view/db_backup_view.xml
@@ -0,0 +1,94 @@
+
+
+
+
+
+ Automated Backups
+ db.backup
+ form
+
+
+
+
+
+
+ Automated Backups
+ db.backup
+ tree
+
+
+
+
+
+
+
+
+
+
+ Automated Backups
+ db.backup
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 07d2ffd5e5baa0eeefd86efab08456333f758279 Mon Sep 17 00:00:00 2001
From: Yenthe
Date: Thu, 26 Mar 2015 15:35:50 +0100
Subject: [PATCH 34/74] Update english pot file
Added all the new fields and sentences. This will be the template for
translations.
---
auto_backup/i18n/auto_backup.pot | 141 +++++++++++++++++++++++++++++++
1 file changed, 141 insertions(+)
create mode 100644 auto_backup/i18n/auto_backup.pot
diff --git a/auto_backup/i18n/auto_backup.pot b/auto_backup/i18n/auto_backup.pot
new file mode 100644
index 00000000000..c560ff6eed9
--- /dev/null
+++ b/auto_backup/i18n/auto_backup.pot
@@ -0,0 +1,141 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * auto_backup
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 5.0.6\n"
+"Report-Msgid-Bugs-To: support@openerp.com\n"
+"POT-Creation-Date: 2009-11-24 13:49:51+0000\n"
+"PO-Revision-Date: 2009-11-24 13:49:51+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.model:0
+msgid "The Object name must start with x_ and not contain any special character !"
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.actions.act_window:0
+msgid "Invalid model name in the action definition."
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.model,name:auto_backup.model_db_backup
+msgid "db.backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "1) Go to Administration / Configuration / Scheduler / Scheduled Actions"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Test"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "IP Configuration"
+msgstr ""
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.module.module,shortdesc:auto_backup.module_meta_information
+msgid "Database Auto-Backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Database Configuration"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "4) Set other values as per your preference"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Automatic backup of all the databases under this can be scheduled as follows: "
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.ui.view:0
+msgid "Invalid XML for View Architecture!"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "2) Schedule new action(create a new record)"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.module.module,description:auto_backup.module_meta_information
+msgid "The generic Open ERP Database Auto-Backup system enables the user to make configurations for the automatic backup of the database.\n"
+"User simply requires to specify host & port under IP Configuration & database(on specified host running at specified port) and backup directory(in which all the backups of the specified database will be stored) under Database Configuration.\n"
+"\n"
+"Automatic backup for all such configured databases under this can then be scheduled as follows: \n"
+" \n"
+"1) Go to Administration / Configuration / Scheduler / Scheduled Actions\n"
+"2) Schedule new action(create a new record)\n"
+"3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under page 'Technical Data'\n"
+"4) Set other values as per your preference"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under page 'Technical Data'"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Help"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr ""
+
From 417174029e42ff8604caabb725e784421576be24 Mon Sep 17 00:00:00 2001
From: Yenthe
Date: Thu, 26 Mar 2015 15:56:06 +0100
Subject: [PATCH 35/74] Dutch translations
Full translation of the module to Dutch
---
auto_backup/i18n/nl.po | 292 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 292 insertions(+)
create mode 100644 auto_backup/i18n/nl.po
diff --git a/auto_backup/i18n/nl.po b/auto_backup/i18n/nl.po
new file mode 100644
index 00000000000..8d739798b29
--- /dev/null
+++ b/auto_backup/i18n/nl.po
@@ -0,0 +1,292 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * auto_backup
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-03-26 14:17+0000\n"
+"PO-Revision-Date: 2015-03-26 14:17+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:137
+#, python-format
+msgid "%s"
+msgstr "%s"
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr "Absoluut pad om backups te bewaren"
+
+#. module: auto_backup
+#: field:db.backup,sendmailsftpfail:0
+msgid "Auto. E-mail on backup fail"
+msgstr "Auto. e-mailen wanneer backup mislukt"
+
+#. module: auto_backup
+#: field:db.backup,autoremove:0
+msgid "Auto. Remove Backups"
+msgstr "Auto. backups verwijderen"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Automatic backups of the database can be scheduled as follows:"
+msgstr "Automatische backups van de database kunnen als volgend gepland worden:"
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr "Backup folder"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_tree
+msgid "Backups"
+msgstr "Backups"
+
+#. module: auto_backup
+#: help:db.backup,daystokeepsftp:0
+msgid "Choose after how many days the backup should be deleted from the FTP server. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days from the FTP server."
+msgstr "Kies na hoeveel dagen de backups verwijderd moeten worden van de FTP server. Bijvoorbeeld:\n"
+"Als u 5 invult zal de backup na 5 dagen verwijderd worden van de FTP server."
+
+#. module: auto_backup
+#: help:db.backup,daystokeep:0
+msgid "Choose after how many days the backup should be deleted. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days."
+msgstr "Kies na hoeveel dagen de backup verwijderd moet worden. Bijvoorbeeld:\n"
+"Als u 5 invult zal de backup verwijderd worden na 5 dagen."
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr "Configureer backup"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Contact us!"
+msgstr "Contacteer ons!"
+
+#. module: auto_backup
+#: field:db.backup,create_uid:0
+msgid "Created by"
+msgstr "Gemaakt door"
+
+#. module: auto_backup
+#: field:db.backup,create_date:0
+msgid "Created on"
+msgstr "Gemaakt op"
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr "Database"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr "Database waar u backups voor wilt plannen"
+
+#. module: auto_backup
+#: field:db.backup,emailtonotify:0
+msgid "E-mail to notify"
+msgstr "E-mail om te verwittigen"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:106
+#: constraint:db.backup:0
+#, python-format
+msgid "Error ! No such database exists!"
+msgstr "Error! Deze database bestaat niet!"
+
+#. module: auto_backup
+#: help:db.backup,emailtonotify:0
+msgid "Fill in the e-mail where you want to be notified that the backup failed on the FTP."
+msgstr "Vul de e-mail in waarop u wilt verwittigd worden als de backup mislukt op de FTP."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "For example: /odoo/backups/"
+msgstr "Bijvoorbeeld: /odoo/backups/"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Go to Settings / Technical / Automation / Scheduled Actions."
+msgstr "Ga naar Instellingen / Technsich / Automatisering / Geplande acties"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Help"
+msgstr "Help"
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr "Host"
+
+#. module: auto_backup
+#: field:db.backup,id:0
+msgid "ID"
+msgstr "ID"
+
+#. module: auto_backup
+#: field:db.backup,sftpip:0
+msgid "IP Address SFTP Server"
+msgstr "IP adres SFTP server"
+
+#. module: auto_backup
+#: help:db.backup,sendmailsftpfail:0
+msgid "If you check this option you can choose to automaticly get e-mailed when the backup to the external server failed."
+msgstr "Als u deze optie aanvinkt kan u kiezen om automatisch een e-mail aan te krijgen als de backup
+naar de externe server mislukt."
+
+#. module: auto_backup
+#: help:db.backup,autoremove:0
+msgid "If you check this option you can choose to automaticly remove the backup after xx days"
+msgstr "Als u deze optie aanvinkt kan u kiezen om automatisch backups te verwijderen na xx dagen"
+
+#. module: auto_backup
+#: help:db.backup,sftpwrite:0
+msgid "If you check this option you can specify the details needed to write to a remote server with SFTP."
+msgstr "Als u deze optie aanvinkt kan u de details invullen die nodig zijn om te connecteren met de externe SFTP server."
+
+#. module: auto_backup
+#: field:db.backup,write_uid:0
+msgid "Last Updated by"
+msgstr "Laatst bijgewerkt door"
+
+#. module: auto_backup
+#: field:db.backup,write_date:0
+msgid "Last Updated on"
+msgstr "Laatst bijgewerkt op"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Local backup configuration"
+msgstr "Lokale backup configuratie"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Need more help?"
+msgstr "Meer hulp nodig?"
+
+#. module: auto_backup
+#: field:db.backup,sftppassword:0
+msgid "Password User SFTP Server"
+msgstr "Wachtwoord gebruiker SFTP server"
+
+#. module: auto_backup
+#: field:db.backup,sftppath:0
+msgid "Path external server"
+msgstr "Pad externe server"
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr "Poort"
+
+#. module: auto_backup
+#: field:db.backup,daystokeepsftp:0
+msgid "Remove SFTP after x days"
+msgstr "SFTP verwijderen na x dagen"
+
+#. module: auto_backup
+#: field:db.backup,daystokeep:0
+msgid "Remove after x days"
+msgstr "Verwijderen na x dagen"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "SFTP"
+msgstr "SFTP"
+
+#. module: auto_backup
+#: field:db.backup,sftpport:0
+msgid "SFTP Port"
+msgstr "SFTP poort"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_search
+msgid "Search options"
+msgstr "Zoekopties"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Search the action named 'Backup scheduler'."
+msgstr "Zoek de actie genaamd 'Backup scheduler'."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Set the scheduler to active and fill in how often you want backups generated."
+msgstr "Zet de planner op actief en vul in hoe vaak de backup moet gemaakt worden."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test"
+msgstr "Test"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test SFTP Connection"
+msgstr "Test SFTP Connectie"
+
+#. module: auto_backup
+#: help:db.backup,sftpip:0
+msgid "The IP address from your remote server. For example 192.168.0.1"
+msgstr "Het IP adres van uw externe server. Bijvoorbeeld: 192.168.0.1"
+
+#. module: auto_backup
+#: help:db.backup,sftppath:0
+msgid "The location to the folder where the dumps should be written to. For example /odoo/backups/.\n"
+"Files will then be written to /odoo/backups/ on your remote server."
+msgstr "De locatie naar de folder waar de backup naar toe moet geschreven worden. Bijvoorbeeld odoo/backups/\n"
+"Bestanden worden dan naar /odoo/backups/ geschreven op de externe server"
+
+#. module: auto_backup
+#: help:db.backup,sftppassword:0
+msgid "The password from the user where the SFTP connection should be made with. This is the password from the user on the external server."
+msgstr "Het wachtwoord van de gebruiker waar de SFTP connectie mee moet gemaakt worden. Dit is het wachtwoord van de gebruiker op de externe server."
+
+#. module: auto_backup
+#: help:db.backup,sftpport:0
+msgid "The port on the FTP server that accepts SSH/SFTP calls."
+msgstr "De poort op de FTP server die SSH/SFTP accepteert."
+
+#. module: auto_backup
+#: help:db.backup,sftpusername:0
+msgid "The username where the SFTP connection should be made with. This is the user on the external server."
+msgstr "De gebruikersnaam waar de SFTP connectie mee gemaakt moet worden. Dit is de gebruiker op de externe server."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
+msgstr "Dit configureert de planner voor automatische backups op de ingegeven database waar de host, poort en database op zijn ingegeven voor reguliere intervallen."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Use SFTP with caution! This writes files to external servers under the path you specify."
+msgstr "Gebruik SFTP voorzichtig! Dit schrijft bestanden naar externe servers onder het pad dat u opgeeft."
+
+#. module: auto_backup
+#: field:db.backup,sftpusername:0
+msgid "Username SFTP Server"
+msgstr "Gebruikersnaam SFTP Server"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Warning:"
+msgstr "Waarschuwing:"
+
+#. module: auto_backup
+#: field:db.backup,sftpwrite:0
+msgid "Write to external server with sftp"
+msgstr "Schrijf naar externe server met SFTP"
From c1a53bfa9a6c6ac3d47411cb2434c9b5dda73c46 Mon Sep 17 00:00:00 2001
From: Yenthe
Date: Fri, 27 Mar 2015 08:13:21 +0100
Subject: [PATCH 36/74] Chinese translations
Add Chinese translations to the module. Written by talway.
---
auto_backup/i18n/zh_CN.po | 298 ++++++++++++++++++++++++++++++++++++++
1 file changed, 298 insertions(+)
create mode 100644 auto_backup/i18n/zh_CN.po
diff --git a/auto_backup/i18n/zh_CN.po b/auto_backup/i18n/zh_CN.po
new file mode 100644
index 00000000000..352a1e6749c
--- /dev/null
+++ b/auto_backup/i18n/zh_CN.po
@@ -0,0 +1,298 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * auto_backup
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-03-26 14:17+0000\n"
+"PO-Revision-Date: 2015-03-27 00:16+0800\n"
+"Last-Translator: <>\n"
+"Language-Team: Talway <1473162392@qq.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"Language: zh_CN\n"
+"X-Generator: Poedit 1.7.5\n"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:137
+#, python-format
+msgid "%s"
+msgstr "%s"
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr "备份据对路径"
+
+#. module: auto_backup
+#: field:db.backup,sendmailsftpfail:0
+msgid "Auto. E-mail on backup fail"
+msgstr "自动。电子邮件备份失败"
+
+#. module: auto_backup
+#: field:db.backup,autoremove:0
+msgid "Auto. Remove Backups"
+msgstr "自动 删除备份"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Automatic backups of the database can be scheduled as follows:"
+msgstr "数据库的自动备份时间安排如下:"
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr "备份目录"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_tree
+msgid "Backups"
+msgstr "备份"
+
+#. module: auto_backup
+#: help:db.backup,daystokeepsftp:0
+msgid ""
+"Choose after how many days the backup should be deleted from the FTP server. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days from the FTP server."
+msgstr ""
+"选择后多少天备份应被删除从 FTP 服务器。例如: \n"
+"如果你填写 5, 将5 天后 从FTP 服务器 删除备份文件。"
+
+#. module: auto_backup
+#: help:db.backup,daystokeep:0
+msgid ""
+"Choose after how many days the backup should be deleted. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days."
+msgstr ""
+"选择后多少天备份应被删除。例如: \n"
+"如果 你填写 5 ,将 5 天后删除备份。"
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr "数据库备份"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Contact us!"
+msgstr "联系我们!"
+
+#. module: auto_backup
+#: field:db.backup,create_uid:0
+msgid "Created by"
+msgstr "创建者"
+
+#. module: auto_backup
+#: field:db.backup,create_date:0
+msgid "Created on"
+msgstr "创建时间"
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr "数据库"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr "计划备份的数据库"
+
+#. module: auto_backup
+#: field:db.backup,emailtonotify:0
+msgid "E-mail to notify"
+msgstr "邮件通知"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:106 constraint:db.backup:0
+#, python-format
+msgid "Error ! No such database exists!"
+msgstr "错误 !这个数据库不存在 !"
+
+#. module: auto_backup
+#: help:db.backup,emailtonotify:0
+msgid "Fill in the e-mail where you want to be notified that the backup failed on the FTP."
+msgstr "FTP备份失败时,邮件通知你详细信息"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "For example: /odoo/backups/"
+msgstr "例如: /odoo/backups/"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Go to Settings / Technical / Automation / Scheduled Actions."
+msgstr "点击 设置 / 技术 / 自动化 / 计划的动作"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Help"
+msgstr "帮助"
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr "服务器"
+
+#. module: auto_backup
+#: field:db.backup,id:0
+msgid "ID"
+msgstr "ID"
+
+#. module: auto_backup
+#: field:db.backup,sftpip:0
+msgid "IP Address SFTP Server"
+msgstr " SFTP 服务器 IP 地址"
+
+#. module: auto_backup
+#: help:db.backup,sendmailsftpfail:0
+msgid "If you check this option you can choose to automaticly get e-mailed when the backup to the external server failed."
+msgstr "如果您选中此选项,您可以选择自动收到通过邮件发送到外部服务器备份失败的信息。"
+
+#. module: auto_backup
+#: help:db.backup,autoremove:0
+msgid "If you check this option you can choose to automaticly remove the backup after xx days"
+msgstr "如果您选中此选项,您可以选择 xx 天后自动删除备份"
+
+#. module: auto_backup
+#: help:db.backup,sftpwrite:0
+msgid "If you check this option you can specify the details needed to write to a remote server with SFTP."
+msgstr "如果您选中此选项,您可以指定需要写入 sftp 的远程服务器的详细信息。"
+
+#. module: auto_backup
+#: field:db.backup,write_uid:0
+msgid "Last Updated by"
+msgstr "最后更新者"
+
+#. module: auto_backup
+#: field:db.backup,write_date:0
+msgid "Last Updated on"
+msgstr "上次更新日期"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Local backup configuration"
+msgstr "本地备份配置"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Need more help?"
+msgstr "需要更多帮助吗?"
+
+#. module: auto_backup
+#: field:db.backup,sftppassword:0
+msgid "Password User SFTP Server"
+msgstr " SFTP服务器密码"
+
+#. module: auto_backup
+#: field:db.backup,sftppath:0
+msgid "Path external server"
+msgstr "服务器目录"
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr "端口"
+
+#. module: auto_backup
+#: field:db.backup,daystokeepsftp:0
+msgid "Remove SFTP after x days"
+msgstr "多少天后从服务器删除"
+
+#. module: auto_backup
+#: field:db.backup,daystokeep:0
+msgid "Remove after x days"
+msgstr "多少天后删除"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "SFTP"
+msgstr "SFTP"
+
+#. module: auto_backup
+#: field:db.backup,sftpport:0
+msgid "SFTP Port"
+msgstr "SFTP 端口"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_search
+msgid "Search options"
+msgstr "搜索选项"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Search the action named 'Backup scheduler'."
+msgstr "搜索计划备份调度程序“Backup scheduler”。"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Set the scheduler to active and fill in how often you want backups generated."
+msgstr "设置计划动作为有效,并填写备份间隔时间,间隔时间单位,间隔次数,执行时间等数据库具体备份方案。"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test"
+msgstr "测试"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test SFTP Connection"
+msgstr "测试 SFTP 连接"
+
+#. module: auto_backup
+#: help:db.backup,sftpip:0
+msgid "The IP address from your remote server. For example 192.168.0.1"
+msgstr "远程服务器的 IP 地址。例如: 192.168.0.1"
+
+#. module: auto_backup
+#: help:db.backup,sftppath:0
+msgid ""
+"The location to the folder where the dumps should be written to. For example /odoo/backups/.\n"
+"Files will then be written to /odoo/backups/ on your remote server."
+msgstr ""
+"转储应将写入的文件夹位置。例如 /odoo/backups/远程服务器上,然后将写入 /odoo/backups/.\n"
+"Files。"
+
+#. module: auto_backup
+#: help:db.backup,sftppassword:0
+msgid "The password from the user where the SFTP connection should be made with. This is the password from the user on the external server."
+msgstr "从 SFTP 服务器连接该用户的密码。这是SFTP服务器上的用户密码。"
+
+#. module: auto_backup
+#: help:db.backup,sftpport:0
+msgid "The port on the FTP server that accepts SSH/SFTP calls."
+msgstr "接受 SSH/SFTP 使用的FTP 服务器上的端口。"
+
+#. module: auto_backup
+#: help:db.backup,sftpusername:0
+msgid "The username where the SFTP connection should be made with. This is the user on the external server."
+msgstr "SFTP 连接使用该用户名。这是在SFTP服务器上的用户。"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
+msgstr "配置适用指定数据库备份 在设置服务器端口定期运行"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Use SFTP with caution! This writes files to external servers under the path you specify."
+msgstr "请注意你的 SFTP服务器网络安全!数据库备份文件将备份到你的SFTP服务器,文件保存在设置的目录下面。"
+
+#. module: auto_backup
+#: field:db.backup,sftpusername:0
+msgid "Username SFTP Server"
+msgstr "SFTP 服务器 用户名"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Warning:"
+msgstr "警告:"
+
+#. module: auto_backup
+#: field:db.backup,sftpwrite:0
+msgid "Write to external server with sftp"
+msgstr "备份到外部 sftp 服务器"
From d70e682d03964a1dcc6337fd358e112050775d05 Mon Sep 17 00:00:00 2001
From: Yenthe
Date: Fri, 27 Mar 2015 13:21:14 +0100
Subject: [PATCH 37/74] Changes chinese translation
Changed some translations
---
auto_backup/i18n/zh_CN.po | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/auto_backup/i18n/zh_CN.po b/auto_backup/i18n/zh_CN.po
index 352a1e6749c..8178604fc1f 100644
--- a/auto_backup/i18n/zh_CN.po
+++ b/auto_backup/i18n/zh_CN.po
@@ -26,17 +26,17 @@ msgstr "%s"
#. module: auto_backup
#: help:db.backup,bkp_dir:0
msgid "Absolute path for storing the backups"
-msgstr "备份据对路径"
+msgstr "备份绝对路径"
#. module: auto_backup
#: field:db.backup,sendmailsftpfail:0
msgid "Auto. E-mail on backup fail"
-msgstr "自动。电子邮件备份失败"
+msgstr "FTP备份失败自动邮件通知你"
#. module: auto_backup
#: field:db.backup,autoremove:0
msgid "Auto. Remove Backups"
-msgstr "自动 删除备份"
+msgstr "自动删除备份"
#. module: auto_backup
#: view:db.backup:auto_backup.view_backup_conf_form
@@ -69,7 +69,7 @@ msgid ""
"If you fill in 5 the backups will be removed after 5 days."
msgstr ""
"选择后多少天备份应被删除。例如: \n"
-"如果 你填写 5 ,将 5 天后删除备份。"
+"如果你填写5,将 5 天后删除备份。"
#. module: auto_backup
#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
@@ -80,7 +80,7 @@ msgstr "数据库备份"
#. module: auto_backup
#: view:db.backup:auto_backup.view_backup_conf_form
msgid "Contact us!"
-msgstr "联系我们!"
+msgstr "邮件联系我们!"
#. module: auto_backup
#: field:db.backup,create_uid:0
@@ -105,7 +105,7 @@ msgstr "计划备份的数据库"
#. module: auto_backup
#: field:db.backup,emailtonotify:0
msgid "E-mail to notify"
-msgstr "邮件通知"
+msgstr "E-mail邮件地址"
#. module: auto_backup
#: code:addons/auto_backup/backup_scheduler.py:106 constraint:db.backup:0
@@ -246,7 +246,7 @@ msgstr "测试 SFTP 连接"
#. module: auto_backup
#: help:db.backup,sftpip:0
msgid "The IP address from your remote server. For example 192.168.0.1"
-msgstr "远程服务器的 IP 地址。例如: 192.168.0.1"
+msgstr "SFTP服务器的 IP 地址。例如: 192.168.0.1"
#. module: auto_backup
#: help:db.backup,sftppath:0
@@ -285,7 +285,7 @@ msgstr "请注意你的 SFTP服务器网络安全!数据库备份文件将备
#. module: auto_backup
#: field:db.backup,sftpusername:0
msgid "Username SFTP Server"
-msgstr "SFTP 服务器 用户名"
+msgstr "SFTP服务器用户名"
#. module: auto_backup
#: view:db.backup:auto_backup.view_backup_conf_form
From 1a88fd94de2065690734278ba37472f79a73f8ea Mon Sep 17 00:00:00 2001
From: Yenthe
Date: Mon, 20 Apr 2015 09:27:04 +0200
Subject: [PATCH 38/74] Full German translations
Thanks to Martin Schmid!
---
auto_backup/i18n/de.po | 299 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 299 insertions(+)
create mode 100644 auto_backup/i18n/de.po
diff --git a/auto_backup/i18n/de.po b/auto_backup/i18n/de.po
new file mode 100644
index 00000000000..7320d2875e4
--- /dev/null
+++ b/auto_backup/i18n/de.po
@@ -0,0 +1,299 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * auto_backup
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-03-26 14:17+0000\n"
+"PO-Revision-Date: 2015-04-17 11:24+0100\n"
+"Last-Translator: Martin Schmid \n"
+"Language-Team: Equitania Software GmbH \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 1.7.5\n"
+"Language: de\n"
+"X-Poedit-SourceCharset: UTF-8\n"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:137
+#, python-format
+msgid "%s"
+msgstr "%s"
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr "Absoluter Pfad zum Speichern der Sicherungen"
+
+#. module: auto_backup
+#: field:db.backup,sendmailsftpfail:0
+msgid "Auto. E-mail on backup fail"
+msgstr "Auto. E-Mail, wenn Datensicherung fehlschlägt"
+
+#. module: auto_backup
+#: field:db.backup,autoremove:0
+msgid "Auto. Remove Backups"
+msgstr "Auto. Entfernen von Sicherungen"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Automatic backups of the database can be scheduled as follows:"
+msgstr "Automatische Sicherungen der Datenbank können wie folgt geplant werden:"
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr "Sicherungs-Verzeichnis"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_tree
+msgid "Backups"
+msgstr "Sicherungen"
+
+#. module: auto_backup
+#: help:db.backup,daystokeepsftp:0
+msgid ""
+"Choose after how many days the backup should be deleted from the FTP server. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days from the FTP server."
+msgstr ""
+"Wählen Sie, nach wie vielen Tagen die Sicherung vom FTP-Server gelöscht werden soll. Beispiel: \n"
+"Wenn Sie \"5\" angeben, werden die Sicherungen nach 5 Tagen vom FTP-Server entfernt."
+
+#. module: auto_backup
+#: help:db.backup,daystokeep:0
+msgid ""
+"Choose after how many days the backup should be deleted. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days."
+msgstr ""
+"Wählen Sie, nach wie vielen Tagen die Sicherung vom FTP-Server gelöscht werden soll. Beispiel: \n"
+"Wenn Sie \"5\" angeben, werden die Sicherungen nach 5 Tagen vom FTP-Server entfernt."
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr "Backup einstellen"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Contact us!"
+msgstr "Sprechen Sie uns an!"
+
+#. module: auto_backup
+#: field:db.backup,create_uid:0
+msgid "Created by"
+msgstr "Erstellt von"
+
+#. module: auto_backup
+#: field:db.backup,create_date:0
+msgid "Created on"
+msgstr "Erstellt am:"
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr "Datenbank"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr "Datenbank Sicherungen einplanen für"
+
+#. module: auto_backup
+#: field:db.backup,emailtonotify:0
+msgid "E-mail to notify"
+msgstr "E-Mail Benachrichtigen"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:106 constraint:db.backup:0
+#, python-format
+msgid "Error ! No such database exists!"
+msgstr "Fehler! Keine solche Datenbank vorhanden!"
+
+#. module: auto_backup
+#: help:db.backup,emailtonotify:0
+msgid "Fill in the e-mail where you want to be notified that the backup failed on the FTP."
+msgstr "Geben Sie die E-Mail-Adresse an, die bei Sicherungsfehlern auf dem FTP verwendet werden soll."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "For example: /odoo/backups/"
+msgstr "Zum Beispiel: /odoo/Backups /"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Go to Settings / Technical / Automation / Scheduled Actions."
+msgstr "Gehen Sie zu Einstellungen / Technisch / Automation / Geplante Vorgänge"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Help"
+msgstr "Hilfe"
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr "Host"
+
+#. module: auto_backup
+#: field:db.backup,id:0
+msgid "ID"
+msgstr "ID"
+
+#. module: auto_backup
+#: field:db.backup,sftpip:0
+msgid "IP Address SFTP Server"
+msgstr "IP-Adresse SFTP-Server"
+
+#. module: auto_backup
+#: help:db.backup,sendmailsftpfail:0
+msgid "If you check this option you can choose to automaticly get e-mailed when the backup to the external server failed."
+msgstr "Wenn Sie diese Option aktivieren, erhalten Sie automatisch eine e-Mail, wenn die Sicherung mit dem externen Server fehlgeschlagen ist."
+
+#. module: auto_backup
+#: help:db.backup,autoremove:0
+msgid "If you check this option you can choose to automaticly remove the backup after xx days"
+msgstr "Wenn Sie diese Option aktivieren, können Sie die Sicherung automatisch nach Xx Tagen entfernen"
+
+#. module: auto_backup
+#: help:db.backup,sftpwrite:0
+msgid "If you check this option you can specify the details needed to write to a remote server with SFTP."
+msgstr "Wenn Sie diese Option aktivieren, können Sie Details für einen entfernten SFTP-Server angeben."
+
+#. module: auto_backup
+#: field:db.backup,write_uid:0
+msgid "Last Updated by"
+msgstr "Zuletzt aktualisiert von"
+
+#. module: auto_backup
+#: field:db.backup,write_date:0
+msgid "Last Updated on"
+msgstr "Zuletzt aktualisiert am"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Local backup configuration"
+msgstr "Lokale Sicherungs-Konfiguration"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Need more help?"
+msgstr "Benötigen Sie weitere Hilfe?"
+
+#. module: auto_backup
+#: field:db.backup,sftppassword:0
+msgid "Password User SFTP Server"
+msgstr "Passwort Benutzer SFTP-Server"
+
+#. module: auto_backup
+#: field:db.backup,sftppath:0
+msgid "Path external server"
+msgstr "Externen Server Pfad"
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr "Port"
+
+#. module: auto_backup
+#: field:db.backup,daystokeepsftp:0
+msgid "Remove SFTP after x days"
+msgstr "SFTP nach x Tagen entfernen"
+
+#. module: auto_backup
+#: field:db.backup,daystokeep:0
+msgid "Remove after x days"
+msgstr "Entfernen nach x Tagen"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "SFTP"
+msgstr "SFTP"
+
+#. module: auto_backup
+#: field:db.backup,sftpport:0
+msgid "SFTP Port"
+msgstr "SFTP-Port"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_search
+msgid "Search options"
+msgstr "Suchkriterien"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Search the action named 'Backup scheduler'."
+msgstr "Suchen Sie die Aktion mit dem Namen \"Backup Scheduler\"."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Set the scheduler to active and fill in how often you want backups generated."
+msgstr "Setzen Sie die Aktion auf aktiv und geben Sie an wie oft die Sicherungen erstellt werden soll."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test"
+msgstr "Test"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test SFTP Connection"
+msgstr "Verbindung testen"
+
+#. module: auto_backup
+#: help:db.backup,sftpip:0
+msgid "The IP address from your remote server. For example 192.168.0.1"
+msgstr "Die IP-Adresse Ihres entfernten Servers. Zum Beispiel 192.168.0.1"
+
+#. module: auto_backup
+#: help:db.backup,sftppath:0
+msgid ""
+"The location to the folder where the dumps should be written to. For example /odoo/backups/.\n"
+"Files will then be written to /odoo/backups/ on your remote server."
+msgstr ""
+"Der Speicherort für den Ordner an dem die Sicherungen in gespeichert werden sollen. Zum Beispiel wird /odoo/backups/.\n"
+"Files geschrieben zu /odoo/backups / / auf dem remote Server."
+
+#. module: auto_backup
+#: help:db.backup,sftppassword:0
+msgid "The password from the user where the SFTP connection should be made with. This is the password from the user on the external server."
+msgstr "Das Kennwort des Benutzers mit dem die SFTP-Verbindung mit hergestellt werden soll. Dies ist das Kennwort des Benutzers auf dem externen Server."
+
+#. module: auto_backup
+#: help:db.backup,sftpport:0
+msgid "The port on the FTP server that accepts SSH/SFTP calls."
+msgstr "Der Port auf dem FTP-Server, der SSH/SFTP Anfragen annimmt."
+
+#. module: auto_backup
+#: help:db.backup,sftpusername:0
+msgid "The username where the SFTP connection should be made with. This is the user on the external server."
+msgstr "Der Benutzername mit dem die SFTP-Verbindung mit hergestellt werden soll. Dies ist der Benutzer auf dem externen Server."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
+msgstr "Dies ist Konfiguration der Aktion automatisierte Backups der Datenbank auf dem angegebenen Server durchzuführen."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Use SFTP with caution! This writes files to external servers under the path you specify."
+msgstr "Verwenden Sie SFTP mit Vorsicht! Dies schreibt Dateien auf externen Servern unter dem Pfad, den Sie angeben."
+
+#. module: auto_backup
+#: field:db.backup,sftpusername:0
+msgid "Username SFTP Server"
+msgstr "Benutzername SFTP-Server"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Warning:"
+msgstr "Warnung:"
+
+#. module: auto_backup
+#: field:db.backup,sftpwrite:0
+msgid "Write to external server with sftp"
+msgstr "Auf externen Server mit SFTP schreiben"
From 2223b3ba346b1f01c9d3aedd3542686074887302 Mon Sep 17 00:00:00 2001
From: Yenthe
Date: Thu, 7 May 2015 15:54:08 +0200
Subject: [PATCH 39/74] Typo fix
could'nt > couldn't
---
auto_backup/backup_scheduler.py | 267 ++++++++++++++++++++++++++++++++
1 file changed, 267 insertions(+)
create mode 100644 auto_backup/backup_scheduler.py
diff --git a/auto_backup/backup_scheduler.py b/auto_backup/backup_scheduler.py
new file mode 100644
index 00000000000..6ec77a90318
--- /dev/null
+++ b/auto_backup/backup_scheduler.py
@@ -0,0 +1,267 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# 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 .
+#
+##############################################################################
+
+import xmlrpclib
+import socket
+import os
+import time
+import datetime
+import base64
+import re
+try:
+ import pysftp
+except ImportError:
+ raise ImportError('This module needs pysftp to automaticly write backups to the FTP through SFTP.Please install pysftp on your system.(sudo pip install pysftp)')
+from openerp.osv import fields,osv,orm
+from openerp import tools
+from openerp import netsvc
+from openerp import tools, _
+import logging
+_logger = logging.getLogger(__name__)
+
+def execute(connector, method, *args):
+ res = False
+ try:
+ res = getattr(connector,method)(*args)
+ except socket.error,e:
+ raise e
+ return res
+
+addons_path = tools.config['addons_path'] + '/auto_backup/DBbackups'
+
+class db_backup(osv.Model):
+ _name = 'db.backup'
+
+ def get_db_list(self, cr, user, ids, host, port, context={}):
+ print("Host: " + host)
+ print("Port: " + port)
+ uri = 'http://' + host + ':' + port
+ conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/db')
+ db_list = execute(conn, 'list')
+ return db_list
+
+ def _get_db_name(self,cr,uid, vals,context=None):
+ attach_pool = self.pool.get("ir.logging")
+ dbName = cr.dbname
+ return dbName
+
+ _columns = {
+ #Columns local server
+ 'host' : fields.char('Host', size=100, required='True'),
+ 'port' : fields.char('Port', size=10, required='True'),
+ 'name' : fields.char('Database', size=100, required='True',help='Database you want to schedule backups for'),
+ 'bkp_dir' : fields.char('Backup Directory', size=100, help='Absolute path for storing the backups', required='True'),
+ 'autoremove': fields.boolean('Auto. Remove Backups', help="If you check this option you can choose to automaticly remove the backup after xx days"),
+ 'daystokeep': fields.integer('Remove after x days',
+ help="Choose after how many days the backup should be deleted. For example:\nIf you fill in 5 the backups will be removed after 5 days.",required=True),
+ #Columns for external server (SFTP)
+ 'sftpwrite': fields.boolean('Write to external server with sftp', help="If you check this option you can specify the details needed to write to a remote server with SFTP."),
+ 'sftppath': fields.char('Path external server', help="The location to the folder where the dumps should be written to. For example /odoo/backups/.\nFiles will then be written to /odoo/backups/ on your remote server."),
+ 'sftpip': fields.char('IP Address SFTP Server', help="The IP address from your remote server. For example 192.168.0.1"),
+ 'sftpport': fields.integer("SFTP Port", help="The port on the FTP server that accepts SSH/SFTP calls."),
+ 'sftpusername': fields.char('Username SFTP Server', help="The username where the SFTP connection should be made with. This is the user on the external server."),
+ 'sftppassword': fields.char('Password User SFTP Server', help="The password from the user where the SFTP connection should be made with. This is the password from the user on the external server."),
+ 'daystokeepsftp': fields.integer('Remove SFTP after x days', help="Choose after how many days the backup should be deleted from the FTP server. For example:\nIf you fill in 5 the backups will be removed after 5 days from the FTP server."),
+ 'sendmailsftpfail': fields.boolean('Auto. E-mail on backup fail', help="If you check this option you can choose to automaticly get e-mailed when the backup to the external server failed."),
+ 'emailtonotify': fields.char('E-mail to notify', help="Fill in the e-mail where you want to be notified that the backup failed on the FTP."),
+ }
+
+ _defaults = {
+ #'bkp_dir' : lambda *a : addons_path,
+ 'bkp_dir' : '/odoo/backups',
+ 'host' : lambda *a : 'localhost',
+ 'port' : lambda *a : '8069',
+ 'name': _get_db_name,
+ 'daystokeepsftp': 30,
+ 'sftpport': 22,
+ }
+
+ def _check_db_exist(self, cr, user, ids):
+ for rec in self.browse(cr,user,ids):
+ db_list = self.get_db_list(cr, user, ids, rec.host, rec.port)
+ if rec.name in db_list:
+ return True
+ return False
+
+ _constraints = [
+ (_check_db_exist, _('Error ! No such database exists!'), [])
+ ]
+
+
+ def test_sftp_connection(self, cr, uid, ids, context=None):
+ conf_ids= self.search(cr, uid, [])
+ confs = self.browse(cr,uid,conf_ids)
+ #Check if there is a success or fail and write messages
+ messageTitle = ""
+ messageContent = ""
+ for rec in confs:
+ db_list = self.get_db_list(cr, uid, [], rec.host, rec.port)
+ try:
+ pathToWriteTo = rec.sftppath
+ ipHost = rec.sftpip
+ portHost = rec.sftpport
+ usernameLogin = rec.sftpusername
+ passwordLogin = rec.sftppassword
+ #Connect with external server over SFTP, so we know sure that everything works.
+ srv = pysftp.Connection(host=ipHost, username=usernameLogin,
+password=passwordLogin,port=portHost)
+ srv.close()
+ #We have a success.
+ messageTitle = "Connection Test Succeeded!"
+ messageContent = "Everything seems properly set up for FTP back-ups!"
+ except Exception, e:
+ messageTitle = "Connection Test Failed!"
+ if len(rec.sftpip) < 8:
+ messageContent += "\nYour IP address seems to be too short.\n"
+ messageContent += "Here is what we got instead:\n"
+ if "Failed" in messageTitle:
+ raise osv.except_osv(_(messageTitle), _(messageContent + "%s") % tools.ustr(e))
+ else:
+ raise osv.except_osv(_(messageTitle), _(messageContent))
+
+ def schedule_backup(self, cr, user, context={}):
+ conf_ids= self.search(cr, user, [])
+ confs = self.browse(cr,user,conf_ids)
+ for rec in confs:
+ db_list = self.get_db_list(cr, user, [], rec.host, rec.port)
+ if rec.name in db_list:
+ try:
+ if not os.path.isdir(rec.bkp_dir):
+ os.makedirs(rec.bkp_dir)
+ except:
+ raise
+ #Create name for dumpfile.
+ bkp_file='%s_%s.dump' % (time.strftime('%d_%m_%Y_%H_%M_%S'),rec.name)
+ file_path = os.path.join(rec.bkp_dir,bkp_file)
+ fp = open(file_path,'wb')
+ uri = 'http://' + rec.host + ':' + rec.port
+ conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/db')
+ bkp=''
+ try:
+ bkp = execute(conn, 'dump', tools.config['admin_passwd'], rec.name)
+ except:
+ logger.notifyChannel('backup', netsvc.LOG_INFO, "Could'nt backup database %s. Bad database administrator password for server running at http://%s:%s" %(rec.name, rec.host, rec.port))
+ continue
+ bkp = base64.decodestring(bkp)
+ fp.write(bkp)
+ fp.close()
+ else:
+ logger.notifyChannel('backup', netsvc.LOG_INFO, "database %s doesn't exist on http://%s:%s" %(rec.name, rec.host, rec.port))
+
+ #Check if user wants to write to SFTP or not.
+ if rec.sftpwrite is True:
+ try:
+ #Store all values in variables
+ dir = rec.bkp_dir
+ pathToWriteTo = rec.sftppath
+ ipHost = rec.sftpip
+ portHost = rec.sftpport
+ usernameLogin = rec.sftpusername
+ passwordLogin = rec.sftppassword
+ #Connect with external server over SFTP
+ srv = pysftp.Connection(host=ipHost, username=usernameLogin,
+password=passwordLogin, port=portHost)
+ #Move to the correct directory on external server. If the user made a typo in his path with multiple slashes (/odoo//backups/) it will be fixed by this regex.
+ pathToWriteTo = re.sub('([/]{2,5})+','/',pathToWriteTo)
+ print(pathToWriteTo)
+ try:
+ srv.chdir(pathToWriteTo)
+ except IOError:
+ #Create directory and subdirs if they do not exist.
+ currentDir = ''
+ for dirElement in pathToWriteTo.split('/'):
+ currentDir += dirElement + '/'
+ try:
+ srv.chdir(currentDir)
+ except:
+ print('(Part of the) path didn\'t exist. Creating it now at ' + currentDir)
+ #Make directory and then navigate into it
+ srv.mkdir(currentDir, mode=777)
+ srv.chdir(currentDir)
+ pass
+ srv.chdir(pathToWriteTo)
+ #Loop over all files in the directory.
+ for f in os.listdir(dir):
+ fullpath = os.path.join(dir, f)
+ if os.path.isfile(fullpath):
+ print(fullpath)
+ srv.put(fullpath)
+
+ #Navigate in to the correct folder.
+ srv.chdir(pathToWriteTo)
+
+ #Loop over all files in the directory from the back-ups.
+ #We will check the creation date of every back-up.
+ for file in srv.listdir(pathToWriteTo):
+ #Get the full path
+ fullpath = os.path.join(pathToWriteTo,file)
+ #Get the timestamp from the file on the external server
+ timestamp = srv.stat(fullpath).st_atime
+ createtime = datetime.datetime.fromtimestamp(timestamp)
+ now = datetime.datetime.now()
+ delta = now - createtime
+ #If the file is older than the daystokeepsftp (the days to keep that the user filled in on the Odoo form it will be removed.
+ if delta.days >= rec.daystokeepsftp:
+ #Only delete files, no directories!
+ if srv.isfile(fullpath) and ".dump" in file:
+ print("Delete: " + file)
+ srv.unlink(file)
+ #Close the SFTP session.
+ srv.close()
+ except Exception, e:
+ _logger.debug('Exception! We couldn\'t back up to the FTP server..')
+ #At this point the SFTP backup failed. We will now check if the user wants
+ #an e-mail notification about this.
+ if rec.sendmailsftpfail:
+ try:
+ ir_mail_server = self.pool.get('ir.mail_server')
+ message = "Dear,\n\nThe backup for the server " + rec.host + " (IP: " + rec.sftpip + ") failed.Please check the following details:\n\nIP address SFTP server: " + rec.sftpip + "\nUsername: " + rec.sftpusername + "\nPassword: " + rec.sftppassword + "\n\nError details: " + tools.ustr(e) + "\n\nWith kind regards"
+ msg = ir_mail_server.build_email("auto_backup@" + rec.name + ".com", [rec.emailtonotify], "Backup from " + rec.host + "(" + rec.sftpip + ") failed", message)
+ ir_mail_server.send_email(cr, user, msg)
+ except Exception:
+ pass
+
+ """Remove all old files (on local server) in case this is configured..
+ This is done after the SFTP writing to prevent unusual behaviour:
+ If the user would set local back-ups to be kept 0 days and the SFTP
+ to keep backups xx days there wouldn't be any new back-ups added to the
+ SFTP.
+ If we'd remove the dump files before they're writen to the SFTP there willbe nothing to write. Meaning that if an user doesn't want to keep back-ups locally and only wants them on the SFTP (NAS for example) there wouldn't be any writing to the remote server if this if statement was before the SFTP write method right above this comment.
+ """
+ if rec.autoremove is True:
+ dir = rec.bkp_dir
+ #Loop over all files in the directory.
+ for f in os.listdir(dir):
+ fullpath = os.path.join(dir, f)
+ timestamp = os.stat(fullpath).st_ctime
+ createtime = datetime.datetime.fromtimestamp(timestamp)
+ now = datetime.datetime.now()
+ delta = now - createtime
+ if delta.days >= rec.daystokeep:
+ #Only delete files (which are .dump), no directories.
+ if os.path.isfile(fullpath) and ".dump" in f:
+ print("Delete: " + fullpath)
+ os.remove(fullpath)
+
+db_backup()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
From 60d58176d61fbda3a106144aef994832f12620a7 Mon Sep 17 00:00:00 2001
From: Yenthe
Date: Mon, 11 May 2015 14:26:39 +0200
Subject: [PATCH 40/74] Flemish translations
Flemish translations are identical to Dutch.
---
auto_backup/i18n/nl_BE.po | 292 ++++++++++++++++++++++++++++++++++++++
1 file changed, 292 insertions(+)
create mode 100644 auto_backup/i18n/nl_BE.po
diff --git a/auto_backup/i18n/nl_BE.po b/auto_backup/i18n/nl_BE.po
new file mode 100644
index 00000000000..8d739798b29
--- /dev/null
+++ b/auto_backup/i18n/nl_BE.po
@@ -0,0 +1,292 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * auto_backup
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-03-26 14:17+0000\n"
+"PO-Revision-Date: 2015-03-26 14:17+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:137
+#, python-format
+msgid "%s"
+msgstr "%s"
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr "Absoluut pad om backups te bewaren"
+
+#. module: auto_backup
+#: field:db.backup,sendmailsftpfail:0
+msgid "Auto. E-mail on backup fail"
+msgstr "Auto. e-mailen wanneer backup mislukt"
+
+#. module: auto_backup
+#: field:db.backup,autoremove:0
+msgid "Auto. Remove Backups"
+msgstr "Auto. backups verwijderen"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Automatic backups of the database can be scheduled as follows:"
+msgstr "Automatische backups van de database kunnen als volgend gepland worden:"
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr "Backup folder"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_tree
+msgid "Backups"
+msgstr "Backups"
+
+#. module: auto_backup
+#: help:db.backup,daystokeepsftp:0
+msgid "Choose after how many days the backup should be deleted from the FTP server. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days from the FTP server."
+msgstr "Kies na hoeveel dagen de backups verwijderd moeten worden van de FTP server. Bijvoorbeeld:\n"
+"Als u 5 invult zal de backup na 5 dagen verwijderd worden van de FTP server."
+
+#. module: auto_backup
+#: help:db.backup,daystokeep:0
+msgid "Choose after how many days the backup should be deleted. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days."
+msgstr "Kies na hoeveel dagen de backup verwijderd moet worden. Bijvoorbeeld:\n"
+"Als u 5 invult zal de backup verwijderd worden na 5 dagen."
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr "Configureer backup"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Contact us!"
+msgstr "Contacteer ons!"
+
+#. module: auto_backup
+#: field:db.backup,create_uid:0
+msgid "Created by"
+msgstr "Gemaakt door"
+
+#. module: auto_backup
+#: field:db.backup,create_date:0
+msgid "Created on"
+msgstr "Gemaakt op"
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr "Database"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr "Database waar u backups voor wilt plannen"
+
+#. module: auto_backup
+#: field:db.backup,emailtonotify:0
+msgid "E-mail to notify"
+msgstr "E-mail om te verwittigen"
+
+#. module: auto_backup
+#: code:addons/auto_backup/backup_scheduler.py:106
+#: constraint:db.backup:0
+#, python-format
+msgid "Error ! No such database exists!"
+msgstr "Error! Deze database bestaat niet!"
+
+#. module: auto_backup
+#: help:db.backup,emailtonotify:0
+msgid "Fill in the e-mail where you want to be notified that the backup failed on the FTP."
+msgstr "Vul de e-mail in waarop u wilt verwittigd worden als de backup mislukt op de FTP."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "For example: /odoo/backups/"
+msgstr "Bijvoorbeeld: /odoo/backups/"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Go to Settings / Technical / Automation / Scheduled Actions."
+msgstr "Ga naar Instellingen / Technsich / Automatisering / Geplande acties"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Help"
+msgstr "Help"
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr "Host"
+
+#. module: auto_backup
+#: field:db.backup,id:0
+msgid "ID"
+msgstr "ID"
+
+#. module: auto_backup
+#: field:db.backup,sftpip:0
+msgid "IP Address SFTP Server"
+msgstr "IP adres SFTP server"
+
+#. module: auto_backup
+#: help:db.backup,sendmailsftpfail:0
+msgid "If you check this option you can choose to automaticly get e-mailed when the backup to the external server failed."
+msgstr "Als u deze optie aanvinkt kan u kiezen om automatisch een e-mail aan te krijgen als de backup
+naar de externe server mislukt."
+
+#. module: auto_backup
+#: help:db.backup,autoremove:0
+msgid "If you check this option you can choose to automaticly remove the backup after xx days"
+msgstr "Als u deze optie aanvinkt kan u kiezen om automatisch backups te verwijderen na xx dagen"
+
+#. module: auto_backup
+#: help:db.backup,sftpwrite:0
+msgid "If you check this option you can specify the details needed to write to a remote server with SFTP."
+msgstr "Als u deze optie aanvinkt kan u de details invullen die nodig zijn om te connecteren met de externe SFTP server."
+
+#. module: auto_backup
+#: field:db.backup,write_uid:0
+msgid "Last Updated by"
+msgstr "Laatst bijgewerkt door"
+
+#. module: auto_backup
+#: field:db.backup,write_date:0
+msgid "Last Updated on"
+msgstr "Laatst bijgewerkt op"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Local backup configuration"
+msgstr "Lokale backup configuratie"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Need more help?"
+msgstr "Meer hulp nodig?"
+
+#. module: auto_backup
+#: field:db.backup,sftppassword:0
+msgid "Password User SFTP Server"
+msgstr "Wachtwoord gebruiker SFTP server"
+
+#. module: auto_backup
+#: field:db.backup,sftppath:0
+msgid "Path external server"
+msgstr "Pad externe server"
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr "Poort"
+
+#. module: auto_backup
+#: field:db.backup,daystokeepsftp:0
+msgid "Remove SFTP after x days"
+msgstr "SFTP verwijderen na x dagen"
+
+#. module: auto_backup
+#: field:db.backup,daystokeep:0
+msgid "Remove after x days"
+msgstr "Verwijderen na x dagen"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "SFTP"
+msgstr "SFTP"
+
+#. module: auto_backup
+#: field:db.backup,sftpport:0
+msgid "SFTP Port"
+msgstr "SFTP poort"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_search
+msgid "Search options"
+msgstr "Zoekopties"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Search the action named 'Backup scheduler'."
+msgstr "Zoek de actie genaamd 'Backup scheduler'."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Set the scheduler to active and fill in how often you want backups generated."
+msgstr "Zet de planner op actief en vul in hoe vaak de backup moet gemaakt worden."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test"
+msgstr "Test"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test SFTP Connection"
+msgstr "Test SFTP Connectie"
+
+#. module: auto_backup
+#: help:db.backup,sftpip:0
+msgid "The IP address from your remote server. For example 192.168.0.1"
+msgstr "Het IP adres van uw externe server. Bijvoorbeeld: 192.168.0.1"
+
+#. module: auto_backup
+#: help:db.backup,sftppath:0
+msgid "The location to the folder where the dumps should be written to. For example /odoo/backups/.\n"
+"Files will then be written to /odoo/backups/ on your remote server."
+msgstr "De locatie naar de folder waar de backup naar toe moet geschreven worden. Bijvoorbeeld odoo/backups/\n"
+"Bestanden worden dan naar /odoo/backups/ geschreven op de externe server"
+
+#. module: auto_backup
+#: help:db.backup,sftppassword:0
+msgid "The password from the user where the SFTP connection should be made with. This is the password from the user on the external server."
+msgstr "Het wachtwoord van de gebruiker waar de SFTP connectie mee moet gemaakt worden. Dit is het wachtwoord van de gebruiker op de externe server."
+
+#. module: auto_backup
+#: help:db.backup,sftpport:0
+msgid "The port on the FTP server that accepts SSH/SFTP calls."
+msgstr "De poort op de FTP server die SSH/SFTP accepteert."
+
+#. module: auto_backup
+#: help:db.backup,sftpusername:0
+msgid "The username where the SFTP connection should be made with. This is the user on the external server."
+msgstr "De gebruikersnaam waar de SFTP connectie mee gemaakt moet worden. Dit is de gebruiker op de externe server."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
+msgstr "Dit configureert de planner voor automatische backups op de ingegeven database waar de host, poort en database op zijn ingegeven voor reguliere intervallen."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Use SFTP with caution! This writes files to external servers under the path you specify."
+msgstr "Gebruik SFTP voorzichtig! Dit schrijft bestanden naar externe servers onder het pad dat u opgeeft."
+
+#. module: auto_backup
+#: field:db.backup,sftpusername:0
+msgid "Username SFTP Server"
+msgstr "Gebruikersnaam SFTP Server"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Warning:"
+msgstr "Waarschuwing:"
+
+#. module: auto_backup
+#: field:db.backup,sftpwrite:0
+msgid "Write to external server with sftp"
+msgstr "Schrijf naar externe server met SFTP"
From d7684d84133ec26d41f689791409a4acb2e0b8a2 Mon Sep 17 00:00:00 2001
From: Alessio Gerace
Date: Mon, 11 May 2015 14:50:32 +0200
Subject: [PATCH 41/74] 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.
---
auto_backup/backup_scheduler.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/auto_backup/backup_scheduler.py b/auto_backup/backup_scheduler.py
index 6ec77a90318..cf23b402cf3 100644
--- a/auto_backup/backup_scheduler.py
+++ b/auto_backup/backup_scheduler.py
@@ -152,7 +152,6 @@ def schedule_backup(self, cr, user, context={}):
#Create name for dumpfile.
bkp_file='%s_%s.dump' % (time.strftime('%d_%m_%Y_%H_%M_%S'),rec.name)
file_path = os.path.join(rec.bkp_dir,bkp_file)
- fp = open(file_path,'wb')
uri = 'http://' + rec.host + ':' + rec.port
conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/db')
bkp=''
@@ -162,6 +161,7 @@ def schedule_backup(self, cr, user, context={}):
logger.notifyChannel('backup', netsvc.LOG_INFO, "Could'nt backup database %s. Bad database administrator password for server running at http://%s:%s" %(rec.name, rec.host, rec.port))
continue
bkp = base64.decodestring(bkp)
+ fp = open(file_path,'wb')
fp.write(bkp)
fp.close()
else:
From 9befe1592213776096536086bed906f21d73641c Mon Sep 17 00:00:00 2001
From: Alessio Gerace
Date: Tue, 14 Jul 2015 11:22:24 +0200
Subject: [PATCH 42/74] Porting module to OCA 8.0
---
auto_backup/README.rst | 99 ++++++++++++
auto_backup/__openerp__.py | 40 +++++
auto_backup/backup_data.xml | 18 +++
auto_backup/bkp_conf_view.xml | 112 +++++++++++++
auto_backup/data/backup_data.xml | 18 +++
auto_backup/i18n/ca.po | 157 +++++++++++++++++++
auto_backup/i18n/fr_BE.po | 141 +++++++++++++++++
auto_backup/{ => model}/backup_scheduler.py | 0
auto_backup/static/description/index.html | 100 ++++++++++++
auto_backup/static/description/no_index.html | 100 ++++++++++++
auto_backup/view/bkp_conf_view.xml | 112 +++++++++++++
11 files changed, 897 insertions(+)
create mode 100644 auto_backup/README.rst
create mode 100644 auto_backup/__openerp__.py
create mode 100644 auto_backup/backup_data.xml
create mode 100644 auto_backup/bkp_conf_view.xml
create mode 100644 auto_backup/data/backup_data.xml
create mode 100644 auto_backup/i18n/ca.po
create mode 100644 auto_backup/i18n/fr_BE.po
rename auto_backup/{ => model}/backup_scheduler.py (100%)
create mode 100644 auto_backup/static/description/index.html
create mode 100644 auto_backup/static/description/no_index.html
create mode 100644 auto_backup/view/bkp_conf_view.xml
diff --git a/auto_backup/README.rst b/auto_backup/README.rst
new file mode 100644
index 00000000000..123008f4c28
--- /dev/null
+++ b/auto_backup/README.rst
@@ -0,0 +1,99 @@
+.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
+ :alt: License: AGPL-3
+
+Automated backups
+===========
+
+A tool for all your back-ups, internal and external!
+
+Installation
+============
+
+Before to install this module, you need to:
+
+instal pysftp via pip.
+
+Configuration
+=============
+
+To configure this module, you need to:
+
+* go to ...
+
+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!
+
+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
+a path and everything will be backed up automatically. This is done
+through an SSH (encrypted) tunnel, thanks to pysftp, so your data is
+safe!
+
+Test connection
+---------------
+
+#### 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
+SFTP Connection’ button and you will get message telling you if
+everything is OK, or what is wrong!
+
+E-mail on backup failure
+------------------------
+
+#### 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.
+
+
+Known issues / Roadmap
+======================
+
+* ...
+
+Bug Tracker
+===========
+
+Bugs are tracked on `GitHub Issues `_.
+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 `_.
+
+
+Credits
+=======
+
+Contributors
+------------
+
+* Yenthe Van Ginneken
+* Alessio Gerace
+
+Maintainer
+----------
+
+.. image:: https://odoo-community.org/logo.png
+ :alt: Odoo Community Association
+ :target: https://odoo-community.org
+
+This module is maintained by the OCA.
+
+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.
\ No newline at end of file
diff --git a/auto_backup/__openerp__.py b/auto_backup/__openerp__.py
new file mode 100644
index 00000000000..a72d57c43b2
--- /dev/null
+++ b/auto_backup/__openerp__.py
@@ -0,0 +1,40 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# 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 .
+#
+##############################################################################
+
+{
+ "name" : "Database Auto-Backup",
+ "version" : "1.0",
+ "author" : "VanRoey.be - Yenthe Van Ginneken, Agile Business Group",
+ "website" : "http://www.vanroey.be/applications/bedrijfsbeheer/odoo",
+ "category" : "Tools",
+ "summary": "Backups data base",
+ "depends" : ['base'],
+ "init_xml" : [],
+ "demo_xml" : [],
+ "update_xml" : [
+ "view/bkp_conf_view.xml",
+ "data/backup_data.xml"
+ ],
+ "active": False,
+ "installable": True
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/auto_backup/backup_data.xml b/auto_backup/backup_data.xml
new file mode 100644
index 00000000000..0ab3c103149
--- /dev/null
+++ b/auto_backup/backup_data.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/auto_backup/bkp_conf_view.xml b/auto_backup/bkp_conf_view.xml
new file mode 100644
index 00000000000..27e56937e61
--- /dev/null
+++ b/auto_backup/bkp_conf_view.xml
@@ -0,0 +1,112 @@
+
+
+
+
+ Configure Backup
+ db.backup
+ form
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ form
+ tree,form
+
+
+
+
+
\ No newline at end of file
diff --git a/auto_backup/data/backup_data.xml b/auto_backup/data/backup_data.xml
new file mode 100644
index 00000000000..0ab3c103149
--- /dev/null
+++ b/auto_backup/data/backup_data.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/auto_backup/i18n/ca.po b/auto_backup/i18n/ca.po
new file mode 100644
index 00000000000..cb9e2f1d36b
--- /dev/null
+++ b/auto_backup/i18n/ca.po
@@ -0,0 +1,157 @@
+# Catalan translation for openobject-addons
+# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014
+# This file is distributed under the same license as the openobject-addons package.
+# FIRST AUTHOR , 2014.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: openobject-addons\n"
+"Report-Msgid-Bugs-To: FULL NAME \n"
+"POT-Creation-Date: 2009-11-24 13:49+0000\n"
+"PO-Revision-Date: 2014-10-20 06:41+0000\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: Catalan \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2014-10-21 06:30+0000\n"
+"X-Generator: Launchpad (build 17203)\n"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.model:0
+msgid ""
+"The Object name must start with x_ and not contain any special character !"
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.actions.act_window:0
+msgid "Invalid model name in the action definition."
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.model,name:auto_backup.model_db_backup
+msgid "db.backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid ""
+"1) Go to Administration / Configuration / Scheduler / Scheduled Actions"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Test"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "IP Configuration"
+msgstr ""
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.module.module,shortdesc:auto_backup.module_meta_information
+msgid "Database Auto-Backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Database Configuration"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "4) Set other values as per your preference"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid ""
+"Automatic backup of all the databases under this can be scheduled as "
+"follows: "
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.ui.view:0
+msgid "Invalid XML for View Architecture!"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "2) Schedule new action(create a new record)"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.module.module,description:auto_backup.module_meta_information
+msgid ""
+"The generic Open ERP Database Auto-Backup system enables the user to make "
+"configurations for the automatic backup of the database.\n"
+"User simply requires to specify host & port under IP Configuration & "
+"database(on specified host running at specified port) and backup "
+"directory(in which all the backups of the specified database will be stored) "
+"under Database Configuration.\n"
+"\n"
+"Automatic backup for all such configured databases under this can then be "
+"scheduled as follows: \n"
+" \n"
+"1) Go to Administration / Configuration / Scheduler / Scheduled Actions\n"
+"2) Schedule new action(create a new record)\n"
+"3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under "
+"page 'Technical Data'\n"
+"4) Set other values as per your preference"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid ""
+"3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under "
+"page 'Technical Data'"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Help"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid ""
+"This configures the scheduler for automatic backup of the given database "
+"running on given host at given port on regular intervals."
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr ""
diff --git a/auto_backup/i18n/fr_BE.po b/auto_backup/i18n/fr_BE.po
new file mode 100644
index 00000000000..c560ff6eed9
--- /dev/null
+++ b/auto_backup/i18n/fr_BE.po
@@ -0,0 +1,141 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * auto_backup
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 5.0.6\n"
+"Report-Msgid-Bugs-To: support@openerp.com\n"
+"POT-Creation-Date: 2009-11-24 13:49:51+0000\n"
+"PO-Revision-Date: 2009-11-24 13:49:51+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.model:0
+msgid "The Object name must start with x_ and not contain any special character !"
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.actions.act_window:0
+msgid "Invalid model name in the action definition."
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.model,name:auto_backup.model_db_backup
+msgid "db.backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "1) Go to Administration / Configuration / Scheduler / Scheduled Actions"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Test"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "IP Configuration"
+msgstr ""
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.module.module,shortdesc:auto_backup.module_meta_information
+msgid "Database Auto-Backup"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Database Configuration"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "4) Set other values as per your preference"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Automatic backup of all the databases under this can be scheduled as follows: "
+msgstr ""
+
+#. module: auto_backup
+#: constraint:ir.ui.view:0
+msgid "Invalid XML for View Architecture!"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "2) Schedule new action(create a new record)"
+msgstr ""
+
+#. module: auto_backup
+#: model:ir.module.module,description:auto_backup.module_meta_information
+msgid "The generic Open ERP Database Auto-Backup system enables the user to make configurations for the automatic backup of the database.\n"
+"User simply requires to specify host & port under IP Configuration & database(on specified host running at specified port) and backup directory(in which all the backups of the specified database will be stored) under Database Configuration.\n"
+"\n"
+"Automatic backup for all such configured databases under this can then be scheduled as follows: \n"
+" \n"
+"1) Go to Administration / Configuration / Scheduler / Scheduled Actions\n"
+"2) Schedule new action(create a new record)\n"
+"3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under page 'Technical Data'\n"
+"4) Set other values as per your preference"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under page 'Technical Data'"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "Help"
+msgstr ""
+
+#. module: auto_backup
+#: view:db.backup:0
+msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
+msgstr ""
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr ""
+
diff --git a/auto_backup/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
similarity index 100%
rename from auto_backup/backup_scheduler.py
rename to auto_backup/model/backup_scheduler.py
diff --git a/auto_backup/static/description/index.html b/auto_backup/static/description/index.html
new file mode 100644
index 00000000000..6b3ba3e2b6d
--- /dev/null
+++ b/auto_backup/static/description/index.html
@@ -0,0 +1,100 @@
+
+
+
+
Automated backups
+
A tool for all your back-ups, internal and external!
+
+
+
+
+
+
+
+
+ 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!
+
+ 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 a path and everything will be backed up automatically. This is done through an SSH (encrypted) tunnel, thanks to pysftp, so your data is safe!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Test connection
+
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 SFTP Connection' button and you will get message telling you if everything is OK, or what is wrong!
+
+
+
+
+
+
+
+
E-mail on backup failure
+
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.
+
A tool for all your back-ups, internal and external!
+
+
+
+
+
+
+
+
+ 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!
+
+ 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 a path and everything will be backed up automatically. This is done through an SSH (encrypted) tunnel, thanks to pysftp, so your data is safe!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Test connection
+
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 SFTP Connection' button and you will get message telling you if everything is OK, or what is wrong!
+
+
+
+
+
+
+
+
E-mail on backup failure
+
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.
+
+
diff --git a/auto_backup/view/bkp_conf_view.xml b/auto_backup/view/bkp_conf_view.xml
new file mode 100644
index 00000000000..27e56937e61
--- /dev/null
+++ b/auto_backup/view/bkp_conf_view.xml
@@ -0,0 +1,112 @@
+
+
+
+
+ Configure Backup
+ db.backup
+ form
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ form
+ tree,form
+
+
+
+
+
\ No newline at end of file
From a8ae00d338dc7b91b82492b062112a3d403347cb Mon Sep 17 00:00:00 2001
From: Alessio Gerace
Date: Tue, 14 Jul 2015 11:25:24 +0200
Subject: [PATCH 43/74] [FIX] module
---
auto_backup/__init__.py | 24 ++++++++++++++++++++++++
auto_backup/__openerp__.py | 2 +-
auto_backup/model/__init__.py | 23 +++++++++++++++++++++++
3 files changed, 48 insertions(+), 1 deletion(-)
create mode 100644 auto_backup/__init__.py
create mode 100644 auto_backup/model/__init__.py
diff --git a/auto_backup/__init__.py b/auto_backup/__init__.py
new file mode 100644
index 00000000000..b90f7bb0897
--- /dev/null
+++ b/auto_backup/__init__.py
@@ -0,0 +1,24 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+# Copyright (C) 2015 Agile Business Group
+# 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 .
+#
+##############################################################################
+
+from . import model
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/auto_backup/__openerp__.py b/auto_backup/__openerp__.py
index a72d57c43b2..64f232256f6 100644
--- a/auto_backup/__openerp__.py
+++ b/auto_backup/__openerp__.py
@@ -4,7 +4,7 @@
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
# $Id$
-#
+# Copyright (C) 2015 Agile Business Group
# 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
diff --git a/auto_backup/model/__init__.py b/auto_backup/model/__init__.py
new file mode 100644
index 00000000000..9fa9047c2f3
--- /dev/null
+++ b/auto_backup/model/__init__.py
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# 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 .
+#
+##############################################################################
+
+import backup_scheduler
From e2fc1774db0f3539aefbe84035aca554ac37eaa7 Mon Sep 17 00:00:00 2001
From: archetipo
Date: Mon, 20 Jul 2015 17:38:04 +0200
Subject: [PATCH 44/74] [FIX] bug logger --> _logger call [FIX] Flake8 [RM]
useless files
---
auto_backup/README.rst | 2 +-
auto_backup/data/backup_data.xml | 34 +--
auto_backup/i18n/ca.po | 157 -----------
auto_backup/i18n/fr_BE.po | 141 ----------
auto_backup/model/__init__.py | 2 +-
auto_backup/model/backup_scheduler.py | 376 ++++++++++++++++++--------
auto_backup/view/bkp_conf_view.xml | 208 +++++++-------
7 files changed, 378 insertions(+), 542 deletions(-)
delete mode 100644 auto_backup/i18n/ca.po
delete mode 100644 auto_backup/i18n/fr_BE.po
diff --git a/auto_backup/README.rst b/auto_backup/README.rst
index 123008f4c28..d2a9f55c1b1 100644
--- a/auto_backup/README.rst
+++ b/auto_backup/README.rst
@@ -71,7 +71,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
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 `_.
+`here `_.
Credits
diff --git a/auto_backup/data/backup_data.xml b/auto_backup/data/backup_data.xml
index 0ab3c103149..4714778a5cc 100644
--- a/auto_backup/data/backup_data.xml
+++ b/auto_backup/data/backup_data.xml
@@ -1,18 +1,18 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/auto_backup/i18n/ca.po b/auto_backup/i18n/ca.po
deleted file mode 100644
index cb9e2f1d36b..00000000000
--- a/auto_backup/i18n/ca.po
+++ /dev/null
@@ -1,157 +0,0 @@
-# Catalan translation for openobject-addons
-# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014
-# This file is distributed under the same license as the openobject-addons package.
-# FIRST AUTHOR , 2014.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: openobject-addons\n"
-"Report-Msgid-Bugs-To: FULL NAME \n"
-"POT-Creation-Date: 2009-11-24 13:49+0000\n"
-"PO-Revision-Date: 2014-10-20 06:41+0000\n"
-"Last-Translator: FULL NAME \n"
-"Language-Team: Catalan \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-10-21 06:30+0000\n"
-"X-Generator: Launchpad (build 17203)\n"
-
-#. module: auto_backup
-#: help:db.backup,name:0
-msgid "Database you want to schedule backups for"
-msgstr ""
-
-#. module: auto_backup
-#: constraint:ir.model:0
-msgid ""
-"The Object name must start with x_ and not contain any special character !"
-msgstr ""
-
-#. module: auto_backup
-#: constraint:ir.actions.act_window:0
-msgid "Invalid model name in the action definition."
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.model,name:auto_backup.model_db_backup
-msgid "db.backup"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid ""
-"1) Go to Administration / Configuration / Scheduler / Scheduled Actions"
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
-#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
-msgid "Configure Backup"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "Test"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "IP Configuration"
-msgstr ""
-
-#. module: auto_backup
-#: help:db.backup,bkp_dir:0
-msgid "Absolute path for storing the backups"
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.module.module,shortdesc:auto_backup.module_meta_information
-msgid "Database Auto-Backup"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "Database Configuration"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "4) Set other values as per your preference"
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,host:0
-msgid "Host"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid ""
-"Automatic backup of all the databases under this can be scheduled as "
-"follows: "
-msgstr ""
-
-#. module: auto_backup
-#: constraint:ir.ui.view:0
-msgid "Invalid XML for View Architecture!"
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,bkp_dir:0
-msgid "Backup Directory"
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,name:0
-msgid "Database"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "2) Schedule new action(create a new record)"
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.module.module,description:auto_backup.module_meta_information
-msgid ""
-"The generic Open ERP Database Auto-Backup system enables the user to make "
-"configurations for the automatic backup of the database.\n"
-"User simply requires to specify host & port under IP Configuration & "
-"database(on specified host running at specified port) and backup "
-"directory(in which all the backups of the specified database will be stored) "
-"under Database Configuration.\n"
-"\n"
-"Automatic backup for all such configured databases under this can then be "
-"scheduled as follows: \n"
-" \n"
-"1) Go to Administration / Configuration / Scheduler / Scheduled Actions\n"
-"2) Schedule new action(create a new record)\n"
-"3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under "
-"page 'Technical Data'\n"
-"4) Set other values as per your preference"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid ""
-"3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under "
-"page 'Technical Data'"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "Help"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid ""
-"This configures the scheduler for automatic backup of the given database "
-"running on given host at given port on regular intervals."
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,port:0
-msgid "Port"
-msgstr ""
diff --git a/auto_backup/i18n/fr_BE.po b/auto_backup/i18n/fr_BE.po
deleted file mode 100644
index c560ff6eed9..00000000000
--- a/auto_backup/i18n/fr_BE.po
+++ /dev/null
@@ -1,141 +0,0 @@
-# Translation of OpenERP Server.
-# This file contains the translation of the following modules:
-# * auto_backup
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: OpenERP Server 5.0.6\n"
-"Report-Msgid-Bugs-To: support@openerp.com\n"
-"POT-Creation-Date: 2009-11-24 13:49:51+0000\n"
-"PO-Revision-Date: 2009-11-24 13:49:51+0000\n"
-"Last-Translator: <>\n"
-"Language-Team: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: \n"
-"Plural-Forms: \n"
-
-#. module: auto_backup
-#: help:db.backup,name:0
-msgid "Database you want to schedule backups for"
-msgstr ""
-
-#. module: auto_backup
-#: constraint:ir.model:0
-msgid "The Object name must start with x_ and not contain any special character !"
-msgstr ""
-
-#. module: auto_backup
-#: constraint:ir.actions.act_window:0
-msgid "Invalid model name in the action definition."
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.model,name:auto_backup.model_db_backup
-msgid "db.backup"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "1) Go to Administration / Configuration / Scheduler / Scheduled Actions"
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
-#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
-msgid "Configure Backup"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "Test"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "IP Configuration"
-msgstr ""
-
-#. module: auto_backup
-#: help:db.backup,bkp_dir:0
-msgid "Absolute path for storing the backups"
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.module.module,shortdesc:auto_backup.module_meta_information
-msgid "Database Auto-Backup"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "Database Configuration"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "4) Set other values as per your preference"
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,host:0
-msgid "Host"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "Automatic backup of all the databases under this can be scheduled as follows: "
-msgstr ""
-
-#. module: auto_backup
-#: constraint:ir.ui.view:0
-msgid "Invalid XML for View Architecture!"
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,bkp_dir:0
-msgid "Backup Directory"
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,name:0
-msgid "Database"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "2) Schedule new action(create a new record)"
-msgstr ""
-
-#. module: auto_backup
-#: model:ir.module.module,description:auto_backup.module_meta_information
-msgid "The generic Open ERP Database Auto-Backup system enables the user to make configurations for the automatic backup of the database.\n"
-"User simply requires to specify host & port under IP Configuration & database(on specified host running at specified port) and backup directory(in which all the backups of the specified database will be stored) under Database Configuration.\n"
-"\n"
-"Automatic backup for all such configured databases under this can then be scheduled as follows: \n"
-" \n"
-"1) Go to Administration / Configuration / Scheduler / Scheduled Actions\n"
-"2) Schedule new action(create a new record)\n"
-"3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under page 'Technical Data'\n"
-"4) Set other values as per your preference"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "3) Set 'Object' to 'db.backup' and 'Function' to 'schedule_backup' under page 'Technical Data'"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "Help"
-msgstr ""
-
-#. module: auto_backup
-#: view:db.backup:0
-msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
-msgstr ""
-
-#. module: auto_backup
-#: field:db.backup,port:0
-msgid "Port"
-msgstr ""
-
diff --git a/auto_backup/model/__init__.py b/auto_backup/model/__init__.py
index 9fa9047c2f3..a5a7ebdd8e3 100644
--- a/auto_backup/model/__init__.py
+++ b/auto_backup/model/__init__.py
@@ -20,4 +20,4 @@
#
##############################################################################
-import backup_scheduler
+from . import backup_scheduler
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index cf23b402cf3..bbe24d25108 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -1,25 +1,23 @@
-# -*- encoding: utf-8 -*-
+# -*- encoding: utf-8 -*-
##############################################################################
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
-# $Id$
+# 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 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.
#
-# 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 .
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
#
##############################################################################
-
import xmlrpclib
import socket
import os
@@ -30,27 +28,32 @@
try:
import pysftp
except ImportError:
- raise ImportError('This module needs pysftp to automaticly write backups to the FTP through SFTP.Please install pysftp on your system.(sudo pip install pysftp)')
-from openerp.osv import fields,osv,orm
+ raise ImportError(
+ 'This module needs pysftp to automaticly write backups to the FTP '
+ 'through SFTP.Please install pysftp on your system.'
+ '(sudo pip install pysftp)'
+ )
+from openerp.osv import fields, osv
from openerp import tools
-from openerp import netsvc
-from openerp import tools, _
+from openerp import netsvc, _
import logging
_logger = logging.getLogger(__name__)
+
def execute(connector, method, *args):
res = False
- try:
- res = getattr(connector,method)(*args)
- except socket.error,e:
- raise e
+ try:
+ res = getattr(connector, method)(*args)
+ except socket.error as e:
+ raise e
return res
addons_path = tools.config['addons_path'] + '/auto_backup/DBbackups'
+
class db_backup(osv.Model):
_name = 'db.backup'
-
+
def get_db_list(self, cr, user, ids, host, port, context={}):
print("Host: " + host)
print("Port: " + port)
@@ -59,88 +62,165 @@ def get_db_list(self, cr, user, ids, host, port, context={}):
db_list = execute(conn, 'list')
return db_list
- def _get_db_name(self,cr,uid, vals,context=None):
- attach_pool = self.pool.get("ir.logging")
+ def _get_db_name(self, cr, uid, vals, context=None):
+ # attach_pool = self.pool.get("ir.logging")
dbName = cr.dbname
return dbName
-
+
_columns = {
- #Columns local server
- 'host' : fields.char('Host', size=100, required='True'),
- 'port' : fields.char('Port', size=10, required='True'),
- 'name' : fields.char('Database', size=100, required='True',help='Database you want to schedule backups for'),
- 'bkp_dir' : fields.char('Backup Directory', size=100, help='Absolute path for storing the backups', required='True'),
- 'autoremove': fields.boolean('Auto. Remove Backups', help="If you check this option you can choose to automaticly remove the backup after xx days"),
- 'daystokeep': fields.integer('Remove after x days',
- help="Choose after how many days the backup should be deleted. For example:\nIf you fill in 5 the backups will be removed after 5 days.",required=True),
- #Columns for external server (SFTP)
- 'sftpwrite': fields.boolean('Write to external server with sftp', help="If you check this option you can specify the details needed to write to a remote server with SFTP."),
- 'sftppath': fields.char('Path external server', help="The location to the folder where the dumps should be written to. For example /odoo/backups/.\nFiles will then be written to /odoo/backups/ on your remote server."),
- 'sftpip': fields.char('IP Address SFTP Server', help="The IP address from your remote server. For example 192.168.0.1"),
- 'sftpport': fields.integer("SFTP Port", help="The port on the FTP server that accepts SSH/SFTP calls."),
- 'sftpusername': fields.char('Username SFTP Server', help="The username where the SFTP connection should be made with. This is the user on the external server."),
- 'sftppassword': fields.char('Password User SFTP Server', help="The password from the user where the SFTP connection should be made with. This is the password from the user on the external server."),
- 'daystokeepsftp': fields.integer('Remove SFTP after x days', help="Choose after how many days the backup should be deleted from the FTP server. For example:\nIf you fill in 5 the backups will be removed after 5 days from the FTP server."),
- 'sendmailsftpfail': fields.boolean('Auto. E-mail on backup fail', help="If you check this option you can choose to automaticly get e-mailed when the backup to the external server failed."),
- 'emailtonotify': fields.char('E-mail to notify', help="Fill in the e-mail where you want to be notified that the backup failed on the FTP."),
- }
+ # Columns local server
+ 'host': fields.char('Host', size=100, required='True'),
+ 'port': fields.char('Port', size=10, required='True'),
+ 'name': fields.char(
+ 'Database', size=100, required='True',
+ help='Database you want to schedule backups for'
+ ),
+ 'bkp_dir': fields.char(
+ 'Backup Directory', size=100,
+ help='Absolute path for storing the backups',
+ required='True'
+ ),
+ 'autoremove': fields.boolean(
+ 'Auto. Remove Backups',
+ help=(
+ "If you check this option you can choose to "
+ "automaticly remove the backup after xx days"
+ )
+ ),
+ 'daystokeep': fields.integer(
+ 'Remove after x days',
+ help=(
+ "Choose after how many days the backup should be "
+ "deleted. For example:\nIf you fill in 5 the backups "
+ "will be removed after 5 days."
+ ), required=True
+ ),
+ # Columns for external server (SFTP)
+ 'sftpwrite': fields.boolean(
+ 'Write to external server with sftp',
+ help=(
+ "If you check this option you can specify the details "
+ "needed to write to a remote server with SFTP."
+ )
+ ),
+ 'sftppath': fields.char(
+ 'Path external server',
+ help=(
+ "The location to the folder where the dumps should be "
+ "written to. For example /odoo/backups/.\nFiles will then"
+ " be written to /odoo/backups/ on your remote server."
+ )
+ ),
+ 'sftpip': fields.char(
+ 'IP Address SFTP Server',
+ help=(
+ "The IP address from your remote"
+ " server. For example 192.168.0.1"
+ )
+ ),
+ 'sftpport': fields.integer(
+ "SFTP Port",
+ help="The port on the FTP server that accepts SSH/SFTP calls."
+ ),
+ 'sftpusername': fields.char(
+ 'Username SFTP Server',
+ help=(
+ "The username where the SFTP connection "
+ "should be made with. This is the user on the external server."
+ )
+ ),
+ 'sftppassword': fields.char(
+ 'Password User SFTP Server',
+ help=(
+ "The password from the user where the SFTP connection "
+ "should be made with. This is the password from the user"
+ " on the external server."
+ )
+ ),
+ 'daystokeepsftp': fields.integer(
+ 'Remove SFTP after x days',
+ help=(
+ "Choose after how many days the backup should be deleted "
+ "from the FTP server. For example:\nIf you fill in 5 the "
+ "backups will be removed after 5 days from the FTP server."
+ )
+ ),
+ 'sendmailsftpfail': fields.boolean(
+ 'Auto. E-mail on backup fail', help=(
+ "If you check this option you can choose to automaticly"
+ " get e-mailed when the backup to the external server failed."
+ )
+ ),
+ 'emailtonotify': fields.char(
+ 'E-mail to notify',
+ help=(
+ "Fill in the e-mail where you want to be"
+ " notified that the backup failed on the FTP."
+ )
+ ),
+ }
_defaults = {
- #'bkp_dir' : lambda *a : addons_path,
- 'bkp_dir' : '/odoo/backups',
- 'host' : lambda *a : 'localhost',
- 'port' : lambda *a : '8069',
- 'name': _get_db_name,
- 'daystokeepsftp': 30,
- 'sftpport': 22,
- }
-
+ # 'bkp_dir' : lambda *a : addons_path,
+ 'bkp_dir': '/odoo/backups',
+ 'host': lambda *a: 'localhost',
+ 'port': lambda *a: '8069',
+ 'name': _get_db_name,
+ 'daystokeepsftp': 30,
+ 'sftpport': 22,
+ }
+
def _check_db_exist(self, cr, user, ids):
- for rec in self.browse(cr,user,ids):
+ for rec in self.browse(cr, user, ids):
db_list = self.get_db_list(cr, user, ids, rec.host, rec.port)
if rec.name in db_list:
return True
return False
-
- _constraints = [
- (_check_db_exist, _('Error ! No such database exists!'), [])
- ]
+ _constraints = [
+ (_check_db_exist, _('Error ! No such database exists!'), [])
+ ]
def test_sftp_connection(self, cr, uid, ids, context=None):
- conf_ids= self.search(cr, uid, [])
- confs = self.browse(cr,uid,conf_ids)
- #Check if there is a success or fail and write messages
+ conf_ids = self.search(cr, uid, [])
+ confs = self.browse(cr, uid, conf_ids)
+ # Check if there is a success or fail and write messages
messageTitle = ""
messageContent = ""
for rec in confs:
- db_list = self.get_db_list(cr, uid, [], rec.host, rec.port)
+ # db_list = self.get_db_list(cr, uid, [], rec.host, rec.port)
try:
- pathToWriteTo = rec.sftppath
+ # pathToWriteTo = rec.sftppath
ipHost = rec.sftpip
portHost = rec.sftpport
usernameLogin = rec.sftpusername
passwordLogin = rec.sftppassword
- #Connect with external server over SFTP, so we know sure that everything works.
+ # Connect with external server over SFTP, so we know sure that
+ # everything works.
srv = pysftp.Connection(host=ipHost, username=usernameLogin,
-password=passwordLogin,port=portHost)
+ password=passwordLogin, port=portHost)
srv.close()
- #We have a success.
- messageTitle = "Connection Test Succeeded!"
- messageContent = "Everything seems properly set up for FTP back-ups!"
- except Exception, e:
- messageTitle = "Connection Test Failed!"
+ # We have a success.
+ messageTitle = _("Connection Test Succeeded!")
+ messageContent = _(
+ "Everything seems properly set up for FTP back-ups!")
+ except Exception as e:
+ messageTitle = _("Connection Test Failed!")
if len(rec.sftpip) < 8:
- messageContent += "\nYour IP address seems to be too short.\n"
+ messageContent += _(
+ "\nYour IP address seems to be too short.\n")
messageContent += "Here is what we got instead:\n"
if "Failed" in messageTitle:
- raise osv.except_osv(_(messageTitle), _(messageContent + "%s") % tools.ustr(e))
+ raise osv.except_osv(
+ _(messageTitle), _(
+ messageContent + "%s") %
+ tools.ustr(e))
else:
raise osv.except_osv(_(messageTitle), _(messageContent))
def schedule_backup(self, cr, user, context={}):
- conf_ids= self.search(cr, user, [])
- confs = self.browse(cr,user,conf_ids)
+ conf_ids = self.search(cr, user, [])
+ confs = self.browse(cr, user, conf_ids)
for rec in confs:
db_list = self.get_db_list(cr, user, [], rec.host, rec.port)
if rec.name in db_list:
@@ -149,93 +229,144 @@ def schedule_backup(self, cr, user, context={}):
os.makedirs(rec.bkp_dir)
except:
raise
- #Create name for dumpfile.
- bkp_file='%s_%s.dump' % (time.strftime('%d_%m_%Y_%H_%M_%S'),rec.name)
- file_path = os.path.join(rec.bkp_dir,bkp_file)
+ # Create name for dumpfile.
+ bkp_file = '%s_%s.dump' % (
+ time.strftime('%d_%m_%Y_%H_%M_%S'),
+ rec.name)
+ file_path = os.path.join(rec.bkp_dir, bkp_file)
uri = 'http://' + rec.host + ':' + rec.port
conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/db')
- bkp=''
+ bkp = ''
try:
- bkp = execute(conn, 'dump', tools.config['admin_passwd'], rec.name)
+ bkp = execute(
+ conn,
+ 'dump',
+ tools.config['admin_passwd'],
+ rec.name)
except:
+<<<<<<< HEAD
logger.notifyChannel('backup', netsvc.LOG_INFO, "Could'nt backup database %s. Bad database administrator password for server running at http://%s:%s" %(rec.name, rec.host, rec.port))
+=======
+ _logger.notifyChannel(
+ 'backup', netsvc.LOG_INFO,
+ _(
+ "Couldn't backup database %s. "
+ "Bad database administrator"
+ "password for server running at http://%s:%s"
+ ) % (rec.name, rec.host, rec.port))
+>>>>>>> f331fab... [FIX] bug logger --> _logger call
continue
bkp = base64.decodestring(bkp)
- fp = open(file_path,'wb')
+ fp = open(file_path, 'wb')
fp.write(bkp)
fp.close()
else:
- logger.notifyChannel('backup', netsvc.LOG_INFO, "database %s doesn't exist on http://%s:%s" %(rec.name, rec.host, rec.port))
+ _logger.notifyChannel(
+ 'backup', netsvc.LOG_INFO,
+ "database %s doesn't exist on http://%s:%s" %
+ (rec.name, rec.host, rec.port))
- #Check if user wants to write to SFTP or not.
+ # Check if user wants to write to SFTP or not.
if rec.sftpwrite is True:
try:
- #Store all values in variables
+ # Store all values in variables
dir = rec.bkp_dir
pathToWriteTo = rec.sftppath
ipHost = rec.sftpip
portHost = rec.sftpport
usernameLogin = rec.sftpusername
passwordLogin = rec.sftppassword
- #Connect with external server over SFTP
- srv = pysftp.Connection(host=ipHost, username=usernameLogin,
-password=passwordLogin, port=portHost)
- #Move to the correct directory on external server. If the user made a typo in his path with multiple slashes (/odoo//backups/) it will be fixed by this regex.
- pathToWriteTo = re.sub('([/]{2,5})+','/',pathToWriteTo)
+ # Connect with external server over SFTP
+ srv = pysftp.Connection(
+ host=ipHost,
+ username=usernameLogin,
+ password=passwordLogin,
+ port=portHost)
+ # Move to the correct directory on external server. If the
+ # user made a typo in his path with multiple slashes
+ # (/odoo//backups/) it will be fixed by this regex.
+ pathToWriteTo = re.sub('([/]{2,5})+', '/', pathToWriteTo)
print(pathToWriteTo)
try:
srv.chdir(pathToWriteTo)
except IOError:
- #Create directory and subdirs if they do not exist.
+ # Create directory and subdirs if they do not exist.
currentDir = ''
for dirElement in pathToWriteTo.split('/'):
currentDir += dirElement + '/'
try:
srv.chdir(currentDir)
except:
- print('(Part of the) path didn\'t exist. Creating it now at ' + currentDir)
- #Make directory and then navigate into it
+ _logger.info(
+ _(
+ '(Part of the) path didn\'t exist. '
+ 'Creating it now at %s'
+ ) % currentDir
+ )
+ # Make directory and then navigate into it
srv.mkdir(currentDir, mode=777)
srv.chdir(currentDir)
pass
srv.chdir(pathToWriteTo)
- #Loop over all files in the directory.
+ # Loop over all files in the directory.
for f in os.listdir(dir):
fullpath = os.path.join(dir, f)
if os.path.isfile(fullpath):
print(fullpath)
srv.put(fullpath)
- #Navigate in to the correct folder.
+ # Navigate in to the correct folder.
srv.chdir(pathToWriteTo)
- #Loop over all files in the directory from the back-ups.
- #We will check the creation date of every back-up.
+ # Loop over all files in the directory from the back-ups.
+ # We will check the creation date of every back-up.
for file in srv.listdir(pathToWriteTo):
- #Get the full path
- fullpath = os.path.join(pathToWriteTo,file)
- #Get the timestamp from the file on the external server
+ # Get the full path
+ fullpath = os.path.join(pathToWriteTo, file)
+ # Get the timestamp from the file on the external
+ # server
timestamp = srv.stat(fullpath).st_atime
createtime = datetime.datetime.fromtimestamp(timestamp)
now = datetime.datetime.now()
delta = now - createtime
- #If the file is older than the daystokeepsftp (the days to keep that the user filled in on the Odoo form it will be removed.
+ # If the file is older than the daystokeepsftp (the
+ # days to keep that the user filled in on the Odoo form
+ # it will be removed.
if delta.days >= rec.daystokeepsftp:
- #Only delete files, no directories!
+ # Only delete files, no directories!
if srv.isfile(fullpath) and ".dump" in file:
print("Delete: " + file)
srv.unlink(file)
- #Close the SFTP session.
+ # Close the SFTP session.
srv.close()
- except Exception, e:
- _logger.debug('Exception! We couldn\'t back up to the FTP server..')
- #At this point the SFTP backup failed. We will now check if the user wants
- #an e-mail notification about this.
+ except Exception as e:
+ _logger.debug(
+ 'Exception! We couldn\'t back '
+ 'up to the FTP server..'
+ )
+ # At this point the SFTP backup failed.
+ # We will now check if the user wants
+ # an e-mail notification about this.
if rec.sendmailsftpfail:
try:
- ir_mail_server = self.pool.get('ir.mail_server')
- message = "Dear,\n\nThe backup for the server " + rec.host + " (IP: " + rec.sftpip + ") failed.Please check the following details:\n\nIP address SFTP server: " + rec.sftpip + "\nUsername: " + rec.sftpusername + "\nPassword: " + rec.sftppassword + "\n\nError details: " + tools.ustr(e) + "\n\nWith kind regards"
- msg = ir_mail_server.build_email("auto_backup@" + rec.name + ".com", [rec.emailtonotify], "Backup from " + rec.host + "(" + rec.sftpip + ") failed", message)
+ ir_mail_server = self.pool.get('ir.mail_server')
+ message = (
+ "Dear,\n\nThe backup for the server %s"
+ " (IP: %s) failed.Please check"
+ " the following details:\n\n"
+ "IP address SFTP server: %s \nUsername: %s"
+ "\nPassword: %s"
+ "\n\nError details: %s \n\nWith kind regards"
+ ) % (
+ rec.host, rec.sftpip, rec.sftpip,
+ rec.sftpusername, rec.sftppassword,
+ tools.ustr(e)
+ )
+ msg = ir_mail_server.build_email(
+ "auto_backup@" + rec.name + ".com",
+ [rec.emailtonotify],
+ "Backup from " + rec.host + "(" + rec.sftpip +
+ ") failed", message)
ir_mail_server.send_email(cr, user, msg)
except Exception:
pass
@@ -243,25 +374,34 @@ def schedule_backup(self, cr, user, context={}):
"""Remove all old files (on local server) in case this is configured..
This is done after the SFTP writing to prevent unusual behaviour:
If the user would set local back-ups to be kept 0 days and the SFTP
- to keep backups xx days there wouldn't be any new back-ups added to the
- SFTP.
- If we'd remove the dump files before they're writen to the SFTP there willbe nothing to write. Meaning that if an user doesn't want to keep back-ups locally and only wants them on the SFTP (NAS for example) there wouldn't be any writing to the remote server if this if statement was before the SFTP write method right above this comment.
+ to keep backups xx days there wouldn't be any new back-ups added
+ to the SFTP.
+ If we'd remove the dump files before they're writen to the SFTP
+ there willbe nothing to write. Meaning that if an user doesn't want
+ to keep back-ups locally and only wants them on the SFTP
+ (NAS for example) there wouldn't be any writing to the
+ remote server if this if statement was before the SFTP write method
+ right above this comment.
"""
if rec.autoremove is True:
dir = rec.bkp_dir
- #Loop over all files in the directory.
+ # Loop over all files in the directory.
for f in os.listdir(dir):
fullpath = os.path.join(dir, f)
timestamp = os.stat(fullpath).st_ctime
createtime = datetime.datetime.fromtimestamp(timestamp)
now = datetime.datetime.now()
- delta = now - createtime
+ delta = now - createtime
if delta.days >= rec.daystokeep:
- #Only delete files (which are .dump), no directories.
+ # Only delete files (which are .dump), no directories.
if os.path.isfile(fullpath) and ".dump" in f:
print("Delete: " + fullpath)
os.remove(fullpath)
db_backup()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+<<<<<<< HEAD
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+=======
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+>>>>>>> f331fab... [FIX] bug logger --> _logger call
diff --git a/auto_backup/view/bkp_conf_view.xml b/auto_backup/view/bkp_conf_view.xml
index 27e56937e61..1f35678e663 100644
--- a/auto_backup/view/bkp_conf_view.xml
+++ b/auto_backup/view/bkp_conf_view.xml
@@ -1,112 +1,106 @@
-
-
- Configure Backup
- db.backup
- form
-
-
-
-
-
-
- Configure Backup
- db.backup
- tree
-
-
-
-
-
-
-
-
-
-
-
-
-
- Configure Backup
- db.backup
- search
-
-
-
-
-
-
-
-
-
-
-
+
+ Configure Backup
+ db.backup
+ form
+
+
+
+
-
- Configure Backup
- db.backup
- form
- tree,form
-
-
-
-
+
+ Configure Backup
+ db.backup
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Configure Backup
+ db.backup
+ form
+ tree,form
+
+
+
+
+
\ No newline at end of file
From e661c96276aca38db71c15df42d094dda7c4f328 Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 21 Jul 2015 09:16:42 +0200
Subject: [PATCH 45/74] [FIX] Readme.rst
---
auto_backup/README.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/auto_backup/README.rst b/auto_backup/README.rst
index d2a9f55c1b1..af72d17f3ec 100644
--- a/auto_backup/README.rst
+++ b/auto_backup/README.rst
@@ -68,7 +68,7 @@ Known issues / Roadmap
Bug Tracker
===========
-Bugs are tracked on `GitHub Issues `_.
+Bugs are tracked on `GitHub Issues `_.
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 `_.
From 8b1ec782e6a58aa36d2460d8ce4e953c5efa0bb0 Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 21 Jul 2015 09:25:23 +0200
Subject: [PATCH 46/74] [FIX] defaults value
---
auto_backup/model/backup_scheduler.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index bbe24d25108..0c3983e0ed8 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -163,8 +163,8 @@ def _get_db_name(self, cr, uid, vals, context=None):
_defaults = {
# 'bkp_dir' : lambda *a : addons_path,
'bkp_dir': '/odoo/backups',
- 'host': lambda *a: 'localhost',
- 'port': lambda *a: '8069',
+ 'host': 'localhost',
+ 'port': '8069',
'name': _get_db_name,
'daystokeepsftp': 30,
'sftpport': 22,
From e0445e1c1977e488c391a36e0b03dba664cbeb30 Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 21 Jul 2015 10:15:26 +0200
Subject: [PATCH 47/74] [FIX] rebased commit
---
auto_backup/backup_data.xml | 18 -----
auto_backup/bkp_conf_view.xml | 112 --------------------------
auto_backup/model/backup_scheduler.py | 8 --
3 files changed, 138 deletions(-)
delete mode 100644 auto_backup/backup_data.xml
delete mode 100644 auto_backup/bkp_conf_view.xml
diff --git a/auto_backup/backup_data.xml b/auto_backup/backup_data.xml
deleted file mode 100644
index 0ab3c103149..00000000000
--- a/auto_backup/backup_data.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/auto_backup/bkp_conf_view.xml b/auto_backup/bkp_conf_view.xml
deleted file mode 100644
index 27e56937e61..00000000000
--- a/auto_backup/bkp_conf_view.xml
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-
-
- Configure Backup
- db.backup
- form
-
-
-
-
-
-
- Configure Backup
- db.backup
- tree
-
-
-
-
-
-
-
-
-
-
-
-
-
- Configure Backup
- db.backup
- search
-
-
-
-
-
-
-
-
-
-
-
-
-
- Configure Backup
- db.backup
- form
- tree,form
-
-
-
-
-
\ No newline at end of file
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index 0c3983e0ed8..2c719ddcdeb 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -244,9 +244,6 @@ def schedule_backup(self, cr, user, context={}):
tools.config['admin_passwd'],
rec.name)
except:
-<<<<<<< HEAD
- logger.notifyChannel('backup', netsvc.LOG_INFO, "Could'nt backup database %s. Bad database administrator password for server running at http://%s:%s" %(rec.name, rec.host, rec.port))
-=======
_logger.notifyChannel(
'backup', netsvc.LOG_INFO,
_(
@@ -254,7 +251,6 @@ def schedule_backup(self, cr, user, context={}):
"Bad database administrator"
"password for server running at http://%s:%s"
) % (rec.name, rec.host, rec.port))
->>>>>>> f331fab... [FIX] bug logger --> _logger call
continue
bkp = base64.decodestring(bkp)
fp = open(file_path, 'wb')
@@ -400,8 +396,4 @@ def schedule_backup(self, cr, user, context={}):
db_backup()
-<<<<<<< HEAD
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-=======
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
->>>>>>> f331fab... [FIX] bug logger --> _logger call
From 837c1800725545e7095bc39bc209e6f39e1f141e Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 21 Jul 2015 10:17:56 +0200
Subject: [PATCH 48/74] [RM] description index.html
---
auto_backup/static/description/index.html | 100 ----------------------
1 file changed, 100 deletions(-)
delete mode 100644 auto_backup/static/description/index.html
diff --git a/auto_backup/static/description/index.html b/auto_backup/static/description/index.html
deleted file mode 100644
index 6b3ba3e2b6d..00000000000
--- a/auto_backup/static/description/index.html
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-
-
Automated backups
-
A tool for all your back-ups, internal and external!
-
-
-
-
-
-
-
-
- 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!
-
- 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 a path and everything will be backed up automatically. This is done through an SSH (encrypted) tunnel, thanks to pysftp, so your data is safe!
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Test connection
-
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 SFTP Connection' button and you will get message telling you if everything is OK, or what is wrong!
-
-
-
-
-
-
-
-
E-mail on backup failure
-
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.
-
The backup for the server ${object.host} (IP: ${object.sftpip}) failed.
+
Please check the following details:
+
IP address SFTP server: ${object.sftpip}
+
Username: ${object.sftpusername}
+
Password: ${object.sftppassword}
+
Error details: ${object.lasterrorlog}
+
With kind regards
+
+ ]]>
+
+
+
+
\ No newline at end of file
diff --git a/auto_backup/i18n/it.po b/auto_backup/i18n/it.po
new file mode 100644
index 00000000000..5137ea788f3
--- /dev/null
+++ b/auto_backup/i18n/it.po
@@ -0,0 +1,363 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * auto_backup
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-07-21 13:00+0000\n"
+"PO-Revision-Date: 2015-07-21 13:00+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: auto_backup
+#: model:email.template,body_html:auto_backup.email_template_autobackup_error_noificaiton
+msgid "\n"
+" \n"
+"
Dear,
\n"
+"\n"
+"
The backup for the server ${object.host} (IP: ${object.sftpip}) failed.
\n"
+"
Please check the following details:
\n"
+"
IP address SFTP server: ${object.sftpip}
\n"
+"
Username: ${object.sftpusername}
\n"
+"
Password: ${object.sftppassword}
\n"
+"
Error details: ${object.lasterrorlog}
\n"
+"
With kind regards
\n"
+"\n"
+" "
+msgstr "\n"
+" \n"
+"
Buongiorno,
\n"
+"\n"
+"
Il backup del DB del server ${object.host} (IP: ${object.sftpip}) e' fallito.
\n"
+"
Si prega di controllare le seguenti impostazioni:
\n"
+"
Indirizzo IP server SFTP: ${object.sftpip}
\n"
+"
Username: ${object.sftpusername}
\n"
+"
Password: ${object.sftppassword}
\n"
+"
Dettaglio errore: ${object.lasterrorlog}
\n"
+"
Cordiali Saluti
\n"
+"\n"
+" "
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:204
+#, python-format
+msgid "\n"
+"Your IP address seems to be too short.\n"
+""
+msgstr "\n"
+"L' indirizzo IP sembra essere troppo corto.\n"
+""
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:209
+#, python-format
+msgid "%s"
+msgstr "%s"
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:288
+#, python-format
+msgid "(Part of the) path didn't exist. Creating it now at %s"
+msgstr "(Una parte del) path non esiste. Verra' creato in %s"
+
+#. module: auto_backup
+#: help:db.backup,bkp_dir:0
+msgid "Absolute path for storing the backups"
+msgstr "Percorso assoluto per il salvataggio del DB"
+
+#. module: auto_backup
+#: field:db.backup,sendmailsftpfail:0
+msgid "Auto. E-mail on backup fail"
+msgstr "Auto. E-mail nel caso di errori durante il backup "
+
+#. module: auto_backup
+#: field:db.backup,autoremove:0
+msgid "Auto. Remove Backups"
+msgstr "Rimuovi Backups"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Automatic backups of the database can be scheduled as follows:"
+msgstr "Il backup automatico del DB e' pianificato come segue:"
+
+#. module: auto_backup
+#: field:db.backup,bkp_dir:0
+msgid "Backup Directory"
+msgstr "Backup Directory"
+
+#. module: auto_backup
+#: model:email.template,subject:auto_backup.email_template_autobackup_error_noificaiton
+msgid "Backup from ${object.host} - (${object.sftpip}) failed"
+msgstr "Backup da ${object.host} - (${object.sftpip}) fallito"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_tree
+msgid "Backups"
+msgstr "Backups"
+
+#. module: auto_backup
+#: help:db.backup,daystokeepsftp:0
+msgid "Choose after how many days the backup should be deleted from the FTP server. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days from the FTP server."
+msgstr "Scegliere dopo quanti giorni si possa condsiderare da eliminare, un Backup nel server FTP. Per esempio:\n"
+"se si imposta 5 i files di backups piu' vecchi di 5 giorni saranno eliminati dal server FTP"
+
+#. module: auto_backup
+#: help:db.backup,daystokeep:0
+msgid "Scegliere dopo quanti giorni si possa condsiderare da eliminare un Backup. For example:\n"
+"If you fill in 5 the backups will be removed after 5 days."
+msgstr "Choose after how many days the backup should be deleted. For example:\n"
+"se si imposta 5 i files di backups piu' vecchi di 5 giorni saranno eliminati."
+
+#. module: auto_backup
+#: model:ir.actions.act_window,name:auto_backup.action_backup_conf_form
+#: model:ir.ui.menu,name:auto_backup.backup_conf_menu
+msgid "Configure Backup"
+msgstr "Configura Backup"
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:202
+#, python-format
+msgid "Connection Test Failed!"
+msgstr "Test connessione Fallito!"
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:198
+#, python-format
+msgid "Connection Test Succeeded!"
+msgstr "Test connessione avvenuto con successo!"
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:241
+#, python-format
+msgid "Couldn't backup database %s. Bad database administratorpassword for server running at http://%s:%s"
+msgstr "Impossibile eseguire il backup di %s. DB password erraata per il server http://%s:%s"
+
+#. module: auto_backup
+#: field:db.backup,create_uid:0
+msgid "Created by"
+msgstr "Created by"
+
+#. module: auto_backup
+#: field:db.backup,create_date:0
+msgid "Created on"
+msgstr "Created on"
+
+#. module: auto_backup
+#: field:db.backup,name:0
+msgid "Database"
+msgstr "Database"
+
+#. module: auto_backup
+#: help:db.backup,name:0
+msgid "Database you want to schedule backups for"
+msgstr "Database you want to schedule backups for"
+
+#. module: auto_backup
+#: field:db.backup,emailtonotify:0
+#: field:db.backup,lasterrorlog:0
+msgid "E-mail to notify"
+msgstr "E-mail di notifica"
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:176
+#, python-format
+msgid "Error"
+msgstr "Errore"
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:176
+#, python-format
+msgid "Error ! No such database exists!"
+msgstr "Errore ! Il DB non esiste!"
+
+#. module: auto_backup
+#: code:addons/auto_backup/model/backup_scheduler.py:199
+#, python-format
+msgid "Everything seems properly set up for FTP back-ups!"
+msgstr "Tutto sembra impostato correttamente per il back-up FTP!"
+
+#. module: auto_backup
+#: help:db.backup,emailtonotify:0
+#: help:db.backup,lasterrorlog:0
+msgid "Fill in the e-mail where you want to be notified that the backup failed on the FTP."
+msgstr "Compilare l'e -mail in cui si desidera essere avvisati,se il backup FTP fallisce."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "For example: /odoo/backups/"
+msgstr "Es.: /odoo/backups/"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Go to Settings / Technical / Automation / Scheduled Actions."
+msgstr "Anadare in Settings / Technical / Automation / Scheduled Actions."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Help"
+msgstr "Aiuto"
+
+#. module: auto_backup
+#: field:db.backup,host:0
+msgid "Host"
+msgstr "Host"
+
+#. module: auto_backup
+#: field:db.backup,id:0
+msgid "ID"
+msgstr "ID"
+
+#. module: auto_backup
+#: field:db.backup,sftpip:0
+msgid "IP Address SFTP Server"
+msgstr "IP Address SFTP Server"
+
+#. module: auto_backup
+#: help:db.backup,sendmailsftpfail:0
+msgid "If you check this option you can choose to automaticly get e-mailed when the backup to the external server failed."
+msgstr "Se si seleziona questa opzione è possibile scegliere di essere notificati automaticamente via e-mail quando il backup al server esterno fallisce ."
+
+#. module: auto_backup
+#: help:db.backup,autoremove:0
+msgid "If you check this option you can choose to automaticly remove the backup after xx days"
+msgstr "Se si seleziona questa opzione è possibile scegliere di rimuovere automaticamente il backup dopo xx giorni"
+
+#. module: auto_backup
+#: help:db.backup,sftpwrite:0
+msgid "If you check this option you can specify the details needed to write to a remote server with SFTP."
+msgstr "Se si seleziona questa opzione è possibile specificare i dettagli necessari per scrivere a un server remoto con SFTP ."
+
+#. module: auto_backup
+#: field:db.backup,write_uid:0
+msgid "Last Updated by"
+msgstr "Last Updated by"
+
+#. module: auto_backup
+#: field:db.backup,write_date:0
+msgid "Last Updated on"
+msgstr "Last Updated on"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Local backup configuration"
+msgstr "Configurazione backup locale"
+
+#. module: auto_backup
+#: field:db.backup,sftppassword:0
+msgid "Password User SFTP Server"
+msgstr "Password utene SFTP Server"
+
+#. module: auto_backup
+#: field:db.backup,sftppath:0
+msgid "Path external server"
+msgstr "Path server esterno"
+
+#. module: auto_backup
+#: field:db.backup,port:0
+msgid "Port"
+msgstr "Porta"
+
+#. module: auto_backup
+#: field:db.backup,daystokeepsftp:0
+msgid "Remove SFTP after x days"
+msgstr "Rimuovi backup da SFTP dopo x giorni"
+
+#. module: auto_backup
+#: field:db.backup,daystokeep:0
+msgid "Remove after x days"
+msgstr "Rimuovi dopo x giorni"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "SFTP"
+msgstr "SFTP"
+
+#. module: auto_backup
+#: field:db.backup,sftpport:0
+msgid "SFTP Port"
+msgstr "Porta SFTP"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_search
+msgid "Search options"
+msgstr "Search options"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Search the action named 'Backup scheduler'."
+msgstr "Cerca l'azione denominata ' di pianificazione del backup ' ."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Set the scheduler to active and fill in how often you want backups generated."
+msgstr "Impostare lo scheduler per attivare e compilare la frequenza con cui si desidera generare il backup."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test"
+msgstr "Test"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Test SFTP Connection"
+msgstr "Test SFTP Connection"
+
+#. module: auto_backup
+#: help:db.backup,sftpip:0
+msgid "The IP address from your remote server. For example 192.168.0.1"
+msgstr "Indirizzo IP server remoto. Es. 192.168.0.1"
+
+#. module: auto_backup
+#: help:db.backup,sftppath:0
+msgid "The location to the folder where the dumps should be written to. For example /odoo/backups/.\n"
+"Files will then be written to /odoo/backups/ on your remote server."
+msgstr "La posizione della cartella in cui i dumps devono essere scritti. Es. /odoo/backups/.\n"
+"i files verranno scritti su /odoo/backups/ nel server remoto."
+
+#. module: auto_backup
+#: help:db.backup,sftppassword:0
+msgid "The password from the user where the SFTP connection should be made with. This is the password from the user on the external server."
+msgstr "La password dell'utente con cui la connessione SFTP deve essere fatta. Questa è la password dall'utente sul server esterno ."
+
+#. module: auto_backup
+#: help:db.backup,sftpport:0
+msgid "The port on the FTP server that accepts SSH/SFTP calls."
+msgstr "La porta sul server FTP che accetta chiamate SSH / SFTP."
+
+#. module: auto_backup
+#: help:db.backup,sftpusername:0
+msgid "The username where the SFTP connection should be made with. This is the user on the external server."
+msgstr "Il nome utente in cui la connessione SFTP dovrebbe essere fatto con . Questo è l'utente sul server esterno."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "This configures the scheduler for automatic backup of the given database running on given host at given port on regular intervals."
+msgstr "pianificazione per il backup automatico del database in esecuzione su dato host /porta ad intervalli regolari."
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Use SFTP with caution! This writes files to external servers under the path you specify."
+msgstr "Usare SFTP con cautela ! Questo scrive file su server esterni nel percorso specificato "
+
+#. module: auto_backup
+#: field:db.backup,sftpusername:0
+msgid "Username SFTP Server"
+msgstr "Username SFTP Server"
+
+#. module: auto_backup
+#: view:db.backup:auto_backup.view_backup_conf_form
+msgid "Warning:"
+msgstr "Warning:"
+
+#. module: auto_backup
+#: field:db.backup,sftpwrite:0
+msgid "Write to external server with sftp"
+msgstr "Salva il backup anche su server FTP esterno"
+
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index 2c719ddcdeb..96ed67072e6 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -2,7 +2,7 @@
##############################################################################
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
-# $Id$
+# Copyright 2015 Agile Business Group
#
# 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
@@ -33,9 +33,10 @@
'through SFTP.Please install pysftp on your system.'
'(sudo pip install pysftp)'
)
-from openerp.osv import fields, osv
+from openerp import models, fields, api, _
+from openerp.exceptions import except_orm, Warning
from openerp import tools
-from openerp import netsvc, _
+from openerp import netsvc
import logging
_logger = logging.getLogger(__name__)
@@ -48,142 +49,146 @@ def execute(connector, method, *args):
raise e
return res
-addons_path = tools.config['addons_path'] + '/auto_backup/DBbackups'
-
-class db_backup(osv.Model):
+class db_backup(models.Model):
_name = 'db.backup'
- def get_db_list(self, cr, user, ids, host, port, context={}):
- print("Host: " + host)
- print("Port: " + port)
- uri = 'http://' + host + ':' + port
- conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/db')
+ def get_connection(self, host, port):
+ uri = 'http://%s:%s' % (host, port)
+ return xmlrpclib.ServerProxy(uri + '/xmlrpc/db')
+
+ def get_db_list(self, host, port):
+ conn = self.get_connection(host, port)
db_list = execute(conn, 'list')
return db_list
- def _get_db_name(self, cr, uid, vals, context=None):
- # attach_pool = self.pool.get("ir.logging")
- dbName = cr.dbname
- return dbName
+ @api.model
+ def _get_db_name(self):
+ return self.env.cr.dbname
- _columns = {
- # Columns local server
- 'host': fields.char('Host', size=100, required='True'),
- 'port': fields.char('Port', size=10, required='True'),
- 'name': fields.char(
- 'Database', size=100, required='True',
- help='Database you want to schedule backups for'
- ),
- 'bkp_dir': fields.char(
- 'Backup Directory', size=100,
- help='Absolute path for storing the backups',
- required='True'
- ),
- 'autoremove': fields.boolean(
- 'Auto. Remove Backups',
- help=(
- "If you check this option you can choose to "
- "automaticly remove the backup after xx days"
- )
- ),
- 'daystokeep': fields.integer(
- 'Remove after x days',
- help=(
- "Choose after how many days the backup should be "
- "deleted. For example:\nIf you fill in 5 the backups "
- "will be removed after 5 days."
- ), required=True
- ),
- # Columns for external server (SFTP)
- 'sftpwrite': fields.boolean(
- 'Write to external server with sftp',
- help=(
- "If you check this option you can specify the details "
- "needed to write to a remote server with SFTP."
- )
- ),
- 'sftppath': fields.char(
- 'Path external server',
- help=(
- "The location to the folder where the dumps should be "
- "written to. For example /odoo/backups/.\nFiles will then"
- " be written to /odoo/backups/ on your remote server."
- )
- ),
- 'sftpip': fields.char(
- 'IP Address SFTP Server',
- help=(
- "The IP address from your remote"
- " server. For example 192.168.0.1"
- )
- ),
- 'sftpport': fields.integer(
- "SFTP Port",
- help="The port on the FTP server that accepts SSH/SFTP calls."
- ),
- 'sftpusername': fields.char(
- 'Username SFTP Server',
- help=(
- "The username where the SFTP connection "
- "should be made with. This is the user on the external server."
- )
- ),
- 'sftppassword': fields.char(
- 'Password User SFTP Server',
- help=(
- "The password from the user where the SFTP connection "
- "should be made with. This is the password from the user"
- " on the external server."
- )
- ),
- 'daystokeepsftp': fields.integer(
- 'Remove SFTP after x days',
- help=(
- "Choose after how many days the backup should be deleted "
- "from the FTP server. For example:\nIf you fill in 5 the "
- "backups will be removed after 5 days from the FTP server."
- )
- ),
- 'sendmailsftpfail': fields.boolean(
- 'Auto. E-mail on backup fail', help=(
- "If you check this option you can choose to automaticly"
- " get e-mailed when the backup to the external server failed."
- )
- ),
- 'emailtonotify': fields.char(
- 'E-mail to notify',
- help=(
- "Fill in the e-mail where you want to be"
- " notified that the backup failed on the FTP."
- )
- ),
- }
-
- _defaults = {
- # 'bkp_dir' : lambda *a : addons_path,
- 'bkp_dir': '/odoo/backups',
- 'host': 'localhost',
- 'port': '8069',
- 'name': _get_db_name,
- 'daystokeepsftp': 30,
- 'sftpport': 22,
- }
+ # Columns local server
+ host = fields.Char(
+ string='Host', default='localhost', size=100, required=True)
+ port = fields.Char(
+ string='Port', default='8069', size=10, required=True)
+ name = fields.Char(
+ string='Database', size=100, required=True,
+ default=_get_db_name,
+ help='Database you want to schedule backups for'
+ )
+ bkp_dir = fields.Char(
+ string='Backup Directory', size=100,
+ default='/odoo/backups',
+ help='Absolute path for storing the backups',
+ required=True
+ )
+ autoremove = fields.Boolean(
+ string='Auto. Remove Backups',
+ help=(
+ "If you check this option you can choose to "
+ "automaticly remove the backup after xx days"
+ )
+ )
+ daystokeep = fields.Integer(
+ string='Remove after x days',
+ default=30,
+ help=(
+ "Choose after how many days the backup should be "
+ "deleted. For example:\nIf you fill in 5 the backups "
+ "will be removed after 5 days."
+ ), required=True
+ )
+ sftpwrite = fields.Boolean(
+ string='Write to external server with sftp',
+ help=(
+ "If you check this option you can specify the details "
+ "needed to write to a remote server with SFTP."
+ )
+ )
+ sftppath = fields.Char(
+ string='Path external server',
+ help=(
+ "The location to the folder where the dumps should be "
+ "written to. For example /odoo/backups/.\nFiles will then"
+ " be written to /odoo/backups/ on your remote server."
+ )
+ )
+ sftpip = fields.Char(
+ string='IP Address SFTP Server',
+ help=(
+ "The IP address from your remote"
+ " server. For example 192.168.0.1"
+ )
+ )
+ sftpport = fields.Integer(
+ string="SFTP Port",
+ default=22,
+ help="The port on the FTP server that accepts SSH/SFTP calls."
+ )
+ sftpusername = fields.Char(
+ string='Username SFTP Server',
+ help=(
+ "The username where the SFTP connection "
+ "should be made with. This is the user on the external server."
+ )
+ )
+ sftppassword = fields.Char(
+ string='Password User SFTP Server',
+ help=(
+ "The password from the user where the SFTP connection "
+ "should be made with. This is the password from the user"
+ " on the external server."
+ )
+ )
+ daystokeepsftp = fields.Integer(
+ string='Remove SFTP after x days',
+ default=30,
+ help=(
+ "Choose after how many days the backup should be deleted "
+ "from the FTP server. For example:\nIf you fill in 5 the "
+ "backups will be removed after 5 days from the FTP server."
+ )
+ )
+ sendmailsftpfail = fields.Boolean(
+ string='Auto. E-mail on backup fail',
+ help=(
+ "If you check this option you can choose to automaticly"
+ " get e-mailed when the backup to the external server failed."
+ )
+ )
+ emailtonotify = fields.Char(
+ string='E-mail to notify',
+ help=(
+ "Fill in the e-mail where you want to be"
+ " notified that the backup failed on the FTP."
+ )
+ )
+ lasterrorlog = fields.Text(
+ string='E-mail to notify',
+ help=(
+ "Fill in the e-mail where you want to be"
+ " notified that the backup failed on the FTP."
+ )
+ )
- def _check_db_exist(self, cr, user, ids):
- for rec in self.browse(cr, user, ids):
- db_list = self.get_db_list(cr, user, ids, rec.host, rec.port)
+ @api.multi
+ def _check_db_exist(self):
+ for rec in self:
+ db_list = self.get_db_list(rec.host, rec.port)
if rec.name in db_list:
return True
- return False
+ return False
_constraints = [
- (_check_db_exist, _('Error ! No such database exists!'), [])
+ (
+ _check_db_exist,
+ _('Error ! No such database exists!'), ['name']
+ )
]
- def test_sftp_connection(self, cr, uid, ids, context=None):
- conf_ids = self.search(cr, uid, [])
- confs = self.browse(cr, uid, conf_ids)
+ @api.multi
+ def test_sftp_connection(self):
+ confs = self.search([])
# Check if there is a success or fail and write messages
messageTitle = ""
messageContent = ""
@@ -211,38 +216,35 @@ def test_sftp_connection(self, cr, uid, ids, context=None):
"\nYour IP address seems to be too short.\n")
messageContent += "Here is what we got instead:\n"
if "Failed" in messageTitle:
- raise osv.except_osv(
+ raise except_orm(
_(messageTitle), _(
messageContent + "%s") %
tools.ustr(e))
else:
- raise osv.except_osv(_(messageTitle), _(messageContent))
+ raise Warning(_(messageTitle), _(messageContent))
- def schedule_backup(self, cr, user, context={}):
- conf_ids = self.search(cr, user, [])
- confs = self.browse(cr, user, conf_ids)
- for rec in confs:
- db_list = self.get_db_list(cr, user, [], rec.host, rec.port)
+ @api.model
+ def schedule_backup(self):
+ for rec in self.search([]):
+ db_list = self.get_db_list(rec.host, rec.port)
if rec.name in db_list:
+ file_path = ''
+ bkp_file = ''
try:
if not os.path.isdir(rec.bkp_dir):
os.makedirs(rec.bkp_dir)
except:
raise
# Create name for dumpfile.
- bkp_file = '%s_%s.dump' % (
+ bkp_file = '%s_%s.dimp.zip' % (
time.strftime('%d_%m_%Y_%H_%M_%S'),
rec.name)
file_path = os.path.join(rec.bkp_dir, bkp_file)
- uri = 'http://' + rec.host + ':' + rec.port
- conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/db')
+ conn = self.get_connection(rec.host, rec.port)
bkp = ''
try:
bkp = execute(
- conn,
- 'dump',
- tools.config['admin_passwd'],
- rec.name)
+ conn, 'dump', tools.config['admin_passwd'], rec.name)
except:
_logger.notifyChannel(
'backup', netsvc.LOG_INFO,
@@ -251,7 +253,7 @@ def schedule_backup(self, cr, user, context={}):
"Bad database administrator"
"password for server running at http://%s:%s"
) % (rec.name, rec.host, rec.port))
- continue
+ return False
bkp = base64.decodestring(bkp)
fp = open(file_path, 'wb')
fp.write(bkp)
@@ -261,7 +263,7 @@ def schedule_backup(self, cr, user, context={}):
'backup', netsvc.LOG_INFO,
"database %s doesn't exist on http://%s:%s" %
(rec.name, rec.host, rec.port))
-
+ return False
# Check if user wants to write to SFTP or not.
if rec.sftpwrite is True:
try:
@@ -282,7 +284,6 @@ def schedule_backup(self, cr, user, context={}):
# user made a typo in his path with multiple slashes
# (/odoo//backups/) it will be fixed by this regex.
pathToWriteTo = re.sub('([/]{2,5})+', '/', pathToWriteTo)
- print(pathToWriteTo)
try:
srv.chdir(pathToWriteTo)
except IOError:
@@ -308,7 +309,6 @@ def schedule_backup(self, cr, user, context={}):
for f in os.listdir(dir):
fullpath = os.path.join(dir, f)
if os.path.isfile(fullpath):
- print(fullpath)
srv.put(fullpath)
# Navigate in to the correct folder.
@@ -319,19 +319,23 @@ def schedule_backup(self, cr, user, context={}):
for file in srv.listdir(pathToWriteTo):
# Get the full path
fullpath = os.path.join(pathToWriteTo, file)
- # Get the timestamp from the file on the external
- # server
- timestamp = srv.stat(fullpath).st_atime
- createtime = datetime.datetime.fromtimestamp(timestamp)
- now = datetime.datetime.now()
- delta = now - createtime
- # If the file is older than the daystokeepsftp (the
- # days to keep that the user filled in on the Odoo form
- # it will be removed.
- if delta.days >= rec.daystokeepsftp:
- # Only delete files, no directories!
- if srv.isfile(fullpath) and ".dump" in file:
- print("Delete: " + file)
+ if srv.isfile(fullpath) and ".dump.zip" in file:
+ # Get the timestamp from the file on the external
+ # server
+ timestamp = srv.stat(fullpath).st_atime
+ createtime = (
+ datetime.datetime.fromtimestamp(timestamp)
+ )
+ now = datetime.datetime.now()
+ delta = now - createtime
+ # If the file is older than the daystokeepsftp (the
+ # days to keep that the user filled in on the Odoo
+ # form it will be removed.
+ if (
+ rec.daystokeepsftp > 0 and
+ delta.days >= rec.daystokeepsftp
+ ):
+ # Only delete files, no directories!
srv.unlink(file)
# Close the SFTP session.
srv.close()
@@ -345,25 +349,13 @@ def schedule_backup(self, cr, user, context={}):
# an e-mail notification about this.
if rec.sendmailsftpfail:
try:
- ir_mail_server = self.pool.get('ir.mail_server')
- message = (
- "Dear,\n\nThe backup for the server %s"
- " (IP: %s) failed.Please check"
- " the following details:\n\n"
- "IP address SFTP server: %s \nUsername: %s"
- "\nPassword: %s"
- "\n\nError details: %s \n\nWith kind regards"
- ) % (
- rec.host, rec.sftpip, rec.sftpip,
- rec.sftpusername, rec.sftppassword,
- tools.ustr(e)
+ self.write({'lasterrorlog': tools.ustr(e)})
+ abk_template = self.env.ref(
+ 'auto_backup.'
+ 'email_template_autobackup_error_noificaiton',
+ False
)
- msg = ir_mail_server.build_email(
- "auto_backup@" + rec.name + ".com",
- [rec.emailtonotify],
- "Backup from " + rec.host + "(" + rec.sftpip +
- ") failed", message)
- ir_mail_server.send_email(cr, user, msg)
+ abk_template.send_mail(self.id)
except Exception:
pass
@@ -383,17 +375,16 @@ def schedule_backup(self, cr, user, context={}):
dir = rec.bkp_dir
# Loop over all files in the directory.
for f in os.listdir(dir):
- fullpath = os.path.join(dir, f)
- timestamp = os.stat(fullpath).st_ctime
- createtime = datetime.datetime.fromtimestamp(timestamp)
- now = datetime.datetime.now()
- delta = now - createtime
- if delta.days >= rec.daystokeep:
- # Only delete files (which are .dump), no directories.
- if os.path.isfile(fullpath) and ".dump" in f:
- print("Delete: " + fullpath)
+ if os.path.isfile(fullpath) and ".dump.zip" in f:
+ fullpath = os.path.join(dir, f)
+ timestamp = os.stat(fullpath).st_ctime
+ createtime = (
+ datetime.datetime.fromtimestamp(timestamp)
+ )
+ now = datetime.datetime.now()
+ delta = now - createtime
+ if delta.days >= rec.daystokeep:
os.remove(fullpath)
-
-db_backup()
+ return True
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/auto_backup/security/ir.model.access.csv b/auto_backup/security/ir.model.access.csv
new file mode 100644
index 00000000000..f5de02b31b3
--- /dev/null
+++ b/auto_backup/security/ir.model.access.csv
@@ -0,0 +1,2 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_db_backup,access_db_backup,model_db_backup,,1,0,0,0
\ No newline at end of file
diff --git a/auto_backup/tests/__init__.py b/auto_backup/tests/__init__.py
new file mode 100644
index 00000000000..b35cb66530a
--- /dev/null
+++ b/auto_backup/tests/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright 2015 Agile Business Group
+# Copyright (C) 2015 Alessio Gerace
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from . import test_auto_backup
\ No newline at end of file
diff --git a/auto_backup/tests/test_auto_backup.py b/auto_backup/tests/test_auto_backup.py
new file mode 100644
index 00000000000..a94b4058496
--- /dev/null
+++ b/auto_backup/tests/test_auto_backup.py
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright 2015 Agile Business Group
+# Copyright (C) 2015 Alessio Gerace
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import base64
+from openerp.tests import common
+from openerp.exceptions import except_orm, Warning
+from openerp.modules.module import get_module_resource
+import os
+import time
+from datetime import datetime, date, timedelta
+
+class TestsAutoBackup(common.TransactionCase):
+
+ def setUp(self):
+ super(TestsAutoBackup, self).setUp()
+ self.abk_model = self.env["db.backup"]
+ self.cron_model = self.env["ir.cron"]
+
+
+ def test_0(self):
+ with self.assertRaises(except_orm):
+ self.abk_model.create({'name': 'abcd'})
+
+ def test_1(self):
+ this = self.abk_model.create(
+ {
+ 'bkp_dir': '/tmp'
+ }
+ )
+ self.assertEqual(this.host, 'localhost')
+ cronbk = self.cron_model.search([('name', '=', 'Backup scheduler')])
+ import pdb;pdb.set_trace()
+ cronbk.write(
+ {
+ 'active': True,
+ 'doall': True
+ }
+ )
+ filetime = (
+ datetime.now() + timedelta(minutes=1)
+ ).strftime('%d_%m_%Y_%H_%M_%S')
+
+ bkp_file = '%s_%s.dimp.zip' % (
+ filetime, this.name)
+ file_path = os.path.join(this.bkp_dir, bkp_file)
+ self.assertEqual(os.path.isfile(file_path), True)
From 9fa0b44e02ae2e412dbe750259126a9ba625766e Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 21 Jul 2015 18:30:07 +0200
Subject: [PATCH 50/74] [FIX] test
---
auto_backup/__openerp__.py | 4 +---
auto_backup/tests/test_auto_backup.py | 16 ----------------
2 files changed, 1 insertion(+), 19 deletions(-)
diff --git a/auto_backup/__openerp__.py b/auto_backup/__openerp__.py
index e51b28e38d0..6c5f5bad0a3 100644
--- a/auto_backup/__openerp__.py
+++ b/auto_backup/__openerp__.py
@@ -31,9 +31,7 @@
"category" : "Tools",
"summary": "Backups data base",
"depends" : ['base','email_template'],
- "demo_xml" : [
- "data/backup_data.xml"
- ],
+ "demo" : [],
"data" : [
"view/bkp_conf_view.xml",
"data/backup_data.xml",
diff --git a/auto_backup/tests/test_auto_backup.py b/auto_backup/tests/test_auto_backup.py
index a94b4058496..8e61f6f0ee5 100644
--- a/auto_backup/tests/test_auto_backup.py
+++ b/auto_backup/tests/test_auto_backup.py
@@ -46,19 +46,3 @@ def test_1(self):
}
)
self.assertEqual(this.host, 'localhost')
- cronbk = self.cron_model.search([('name', '=', 'Backup scheduler')])
- import pdb;pdb.set_trace()
- cronbk.write(
- {
- 'active': True,
- 'doall': True
- }
- )
- filetime = (
- datetime.now() + timedelta(minutes=1)
- ).strftime('%d_%m_%Y_%H_%M_%S')
-
- bkp_file = '%s_%s.dimp.zip' % (
- filetime, this.name)
- file_path = os.path.join(this.bkp_dir, bkp_file)
- self.assertEqual(os.path.isfile(file_path), True)
From d57912579fdde6e9b2376c9c2fd1d90323d11155 Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 21 Jul 2015 18:32:20 +0200
Subject: [PATCH 51/74] [FIX] flake8
---
auto_backup/tests/test_auto_backup.py | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/auto_backup/tests/test_auto_backup.py b/auto_backup/tests/test_auto_backup.py
index 8e61f6f0ee5..4f7e08c8cae 100644
--- a/auto_backup/tests/test_auto_backup.py
+++ b/auto_backup/tests/test_auto_backup.py
@@ -19,13 +19,10 @@
#
##############################################################################
-import base64
+
from openerp.tests import common
-from openerp.exceptions import except_orm, Warning
-from openerp.modules.module import get_module_resource
-import os
-import time
-from datetime import datetime, date, timedelta
+from openerp.exceptions import except_orm
+
class TestsAutoBackup(common.TransactionCase):
@@ -34,7 +31,6 @@ def setUp(self):
self.abk_model = self.env["db.backup"]
self.cron_model = self.env["ir.cron"]
-
def test_0(self):
with self.assertRaises(except_orm):
self.abk_model.create({'name': 'abcd'})
From 3a80cfa1b126091f88be0395d6616c26342af49e Mon Sep 17 00:00:00 2001
From: archetipo
Date: Wed, 22 Jul 2015 09:29:59 +0200
Subject: [PATCH 52/74] [IMP] deps in travis.yml [FIX] flake8
---
.travis.yml | 2 +-
auto_backup/__openerp__.py | 16 ++++++++--------
auto_backup/tests/test_auto_backup.py | 1 -
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 0247afd3f00..e31ccc1cea7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,7 +22,7 @@ env:
- TRANSIFEX="1"
- TESTS="1" ODOO_REPO="odoo/odoo"
- TESTS="1" ODOO_REPO="OCA/OCB"
- - UNIT_TEST="1"
+ - UNIT_TEST="1"
virtualenv:
system_site_packages: true
diff --git a/auto_backup/__openerp__.py b/auto_backup/__openerp__.py
index 6c5f5bad0a3..751c7d296f0 100644
--- a/auto_backup/__openerp__.py
+++ b/auto_backup/__openerp__.py
@@ -21,18 +21,18 @@
##############################################################################
{
- "name" : "Database Auto-Backup",
- "version" : "1.0",
- "author" :(
+ "name": "Database Auto-Backup",
+ "version": "1.0",
+ "author": (
"VanRoey.be - Yenthe Van Ginneken, Agile Business Group,"
" Odoo Community Association (OCA)"
),
- "website" : "http://www.vanroey.be/applications/bedrijfsbeheer/odoo",
- "category" : "Tools",
+ "website": "http://www.vanroey.be/applications/bedrijfsbeheer/odoo",
+ "category": "Tools",
"summary": "Backups data base",
- "depends" : ['base','email_template'],
- "demo" : [],
- "data" : [
+ "depends": ['base', 'email_template'],
+ "demo": [],
+ "data": [
"view/bkp_conf_view.xml",
"data/backup_data.xml",
"data/autobackup_mail_template.xml",
diff --git a/auto_backup/tests/test_auto_backup.py b/auto_backup/tests/test_auto_backup.py
index 4f7e08c8cae..a383143a0af 100644
--- a/auto_backup/tests/test_auto_backup.py
+++ b/auto_backup/tests/test_auto_backup.py
@@ -19,7 +19,6 @@
#
##############################################################################
-
from openerp.tests import common
from openerp.exceptions import except_orm
From b9d6243b52d0ce2c3b932c743c0b26e7ca226d3e Mon Sep 17 00:00:00 2001
From: archetipo
Date: Wed, 22 Jul 2015 16:08:16 +0200
Subject: [PATCH 53/74] [FIX] flake8 and pylint
---
auto_backup/model/backup_scheduler.py | 24 ++++++++++++------------
auto_backup/tests/__init__.py | 2 +-
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index 96ed67072e6..262d56fd260 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -359,18 +359,18 @@ def schedule_backup(self):
except Exception:
pass
- """Remove all old files (on local server) in case this is configured..
- This is done after the SFTP writing to prevent unusual behaviour:
- If the user would set local back-ups to be kept 0 days and the SFTP
- to keep backups xx days there wouldn't be any new back-ups added
- to the SFTP.
- If we'd remove the dump files before they're writen to the SFTP
- there willbe nothing to write. Meaning that if an user doesn't want
- to keep back-ups locally and only wants them on the SFTP
- (NAS for example) there wouldn't be any writing to the
- remote server if this if statement was before the SFTP write method
- right above this comment.
- """
+ # Remove all old files (on local server) in case this is configured..
+ # This is done after the SFTP writing to prevent unusual behaviour:
+ # If the user would set local back-ups to be kept 0 days and the SFTP
+ # to keep backups xx days there wouldn't be any new back-ups added
+ # to the SFTP.
+ # If we'd remove the dump files before they're writen to the SFTP
+ # there willbe nothing to write. Meaning that if an user doesn't want
+ # to keep back-ups locally and only wants them on the SFTP
+ # (NAS for example) there wouldn't be any writing to the
+ # remote server if this if statement was before the SFTP write method
+ # right above this comment.
+
if rec.autoremove is True:
dir = rec.bkp_dir
# Loop over all files in the directory.
diff --git a/auto_backup/tests/__init__.py b/auto_backup/tests/__init__.py
index b35cb66530a..01e81ba8a05 100644
--- a/auto_backup/tests/__init__.py
+++ b/auto_backup/tests/__init__.py
@@ -19,4 +19,4 @@
#
##############################################################################
-from . import test_auto_backup
\ No newline at end of file
+from . import test_auto_backup
From 7c3bdebad38bcb7a63097487e5ecee87a377457d Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 28 Jul 2015 10:40:41 +0200
Subject: [PATCH 54/74] [FIX] name of file
---
auto_backup/model/backup_scheduler.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index 262d56fd260..d62b6a3a940 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -236,7 +236,7 @@ def schedule_backup(self):
except:
raise
# Create name for dumpfile.
- bkp_file = '%s_%s.dimp.zip' % (
+ bkp_file = '%s_%s.dump.zip' % (
time.strftime('%d_%m_%Y_%H_%M_%S'),
rec.name)
file_path = os.path.join(rec.bkp_dir, bkp_file)
From a4f584ea9044ca4a9f212219f8eac136b092421c Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 28 Jul 2015 11:07:56 +0200
Subject: [PATCH 55/74] [FIX] autoremove method [FIX] Contributors
---
auto_backup/README.rst | 2 +-
auto_backup/model/backup_scheduler.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/auto_backup/README.rst b/auto_backup/README.rst
index af72d17f3ec..d28db0a525e 100644
--- a/auto_backup/README.rst
+++ b/auto_backup/README.rst
@@ -80,7 +80,7 @@ Credits
Contributors
------------
-* Yenthe Van Ginneken
+* Yenthe Van Ginneken
* Alessio Gerace
Maintainer
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index d62b6a3a940..a836f559cba 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -375,8 +375,8 @@ def schedule_backup(self):
dir = rec.bkp_dir
# Loop over all files in the directory.
for f in os.listdir(dir):
+ fullpath = os.path.join(dir, f)
if os.path.isfile(fullpath) and ".dump.zip" in f:
- fullpath = os.path.join(dir, f)
timestamp = os.stat(fullpath).st_ctime
createtime = (
datetime.datetime.fromtimestamp(timestamp)
From ea8f18cf8477e66898598b160decc22c476f0093 Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 28 Jul 2015 15:13:12 +0200
Subject: [PATCH 56/74] [FIX] mail.tempale seems not work in cron task,
replaced with direct call of mail.mail
---
auto_backup/__openerp__.py | 1 -
auto_backup/data/autobackup_mail_template.xml | 27 --------------
auto_backup/model/backup_scheduler.py | 35 +++++++++++++------
3 files changed, 25 insertions(+), 38 deletions(-)
delete mode 100644 auto_backup/data/autobackup_mail_template.xml
diff --git a/auto_backup/__openerp__.py b/auto_backup/__openerp__.py
index 751c7d296f0..f1b3a2842ec 100644
--- a/auto_backup/__openerp__.py
+++ b/auto_backup/__openerp__.py
@@ -35,7 +35,6 @@
"data": [
"view/bkp_conf_view.xml",
"data/backup_data.xml",
- "data/autobackup_mail_template.xml",
"security/ir.model.access.csv"
],
"active": False,
diff --git a/auto_backup/data/autobackup_mail_template.xml b/auto_backup/data/autobackup_mail_template.xml
deleted file mode 100644
index f3a2d7858b2..00000000000
--- a/auto_backup/data/autobackup_mail_template.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
- Auto Backup Error notification
- auto_backup@${object.name}
- Backup from ${object.host} - (${object.sftpip}) failed
- ${object.emailtonotify}
-
-
- Dear,
-
-
The backup for the server ${object.host} (IP: ${object.sftpip}) failed.
-
Please check the following details:
-
IP address SFTP server: ${object.sftpip}
-
Username: ${object.sftpusername}
-
Password: ${object.sftppassword}
-
Error details: ${object.lasterrorlog}
-
With kind regards
-
- ]]>
-
-
-
-
\ No newline at end of file
diff --git a/auto_backup/model/backup_scheduler.py b/auto_backup/model/backup_scheduler.py
index a836f559cba..f2d5b9c9574 100644
--- a/auto_backup/model/backup_scheduler.py
+++ b/auto_backup/model/backup_scheduler.py
@@ -225,6 +225,7 @@ def test_sftp_connection(self):
@api.model
def schedule_backup(self):
+
for rec in self.search([]):
db_list = self.get_db_list(rec.host, rec.port)
if rec.name in db_list:
@@ -349,15 +350,31 @@ def schedule_backup(self):
# an e-mail notification about this.
if rec.sendmailsftpfail:
try:
- self.write({'lasterrorlog': tools.ustr(e)})
- abk_template = self.env.ref(
- 'auto_backup.'
- 'email_template_autobackup_error_noificaiton',
- False
+ ir_mail_server = self.env['ir.mail_server']
+ message = (
+ "Dear,\n\nThe backup for the server %s"
+ " (IP: %s) failed.Please check"
+ " the following details:\n\n"
+ "IP address SFTP server: %s \nUsername: %s"
+ "\nPassword: %s"
+ "\n\nError details: %s \n\nWith kind regards"
+ ) % (
+ rec.host, rec.sftpip, rec.sftpip,
+ rec.sftpusername, rec.sftppassword,
+ tools.ustr(e)
+ )
+ msg = ir_mail_server.build_email(
+ "auto_backup@%s.com" % rec.name,
+ [rec.emailtonotify],
+ "Backup from %s ( %s ) failed" % (
+ rec.host, rec.sftpip),
+ message)
+ ir_mail_server.send_email(msg)
+
+ except Exception as e:
+ _logger.debug(
+ 'Exception! %s' % tools.ustr(e)
)
- abk_template.send_mail(self.id)
- except Exception:
- pass
# Remove all old files (on local server) in case this is configured..
# This is done after the SFTP writing to prevent unusual behaviour:
@@ -386,5 +403,3 @@ def schedule_backup(self):
if delta.days >= rec.daystokeep:
os.remove(fullpath)
return True
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
From 6d0450ed5953597eedfec6b1426f29edc358694a Mon Sep 17 00:00:00 2001
From: archetipo
Date: Tue, 28 Jul 2015 15:41:08 +0200
Subject: [PATCH 57/74] [FIX] Readme
---
auto_backup/README.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/auto_backup/README.rst b/auto_backup/README.rst
index d28db0a525e..00aaaa37c9f 100644
--- a/auto_backup/README.rst
+++ b/auto_backup/README.rst
@@ -16,9 +16,9 @@ instal pysftp via pip.
Configuration
=============
-To configure this module, you need to:
-
-* go to ...
+Go to Settings -> Configuration -> Configure Backup
+create your configurations for each database that you needed
+to backups.
Usage
=====
From c8e0133dd66bd5d1798043f480370db95962522a Mon Sep 17 00:00:00 2001
From: archetipo
Date: Wed, 2 Sep 2015 08:56:57 +0200
Subject: [PATCH 58/74] [FIX] review remarks
---
auto_backup/i18n/it.po | 28 ------
auto_backup/model/backup_scheduler.py | 132 ++++++++++++++------------
2 files changed, 69 insertions(+), 91 deletions(-)
diff --git a/auto_backup/i18n/it.po b/auto_backup/i18n/it.po
index 5137ea788f3..a12a5cacb74 100644
--- a/auto_backup/i18n/it.po
+++ b/auto_backup/i18n/it.po
@@ -15,34 +15,6 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
-#. module: auto_backup
-#: model:email.template,body_html:auto_backup.email_template_autobackup_error_noificaiton
-msgid "\n"
-" \n"
-"
Dear,
\n"
-"\n"
-"
The backup for the server ${object.host} (IP: ${object.sftpip}) failed.
\n"
-"
Please check the following details:
\n"
-"
IP address SFTP server: ${object.sftpip}
\n"
-"
Username: ${object.sftpusername}
\n"
-"
Password: ${object.sftppassword}
\n"
-"
Error details: ${object.lasterrorlog}
\n"
-"
With kind regards
\n"
-"\n"
-" "
-msgstr "\n"
-" \n"
-"
Buongiorno,
\n"
-"\n"
-"
Il backup del DB del server ${object.host} (IP: ${object.sftpip}) e' fallito.
A tool for all your back-ups, internal and external!
-
-
-
-
-
-
-
-
- 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!
-
- 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 a path and everything will be backed up automatically. This is done through an SSH (encrypted) tunnel, thanks to pysftp, so your data is safe!
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Test connection
-
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 SFTP Connection' button and you will get message telling you if everything is OK, or what is wrong!
-
-
-
-
-
-
-
-
E-mail on backup failure
-
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.
-