mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
update app_auto_back backupfile route
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': "Database auto backup,数据库自动备份",
|
'name': "Database auto backup,数据库自动备份",
|
||||||
'version': '16.24.05.22',
|
'version': '16.24.06.07',
|
||||||
|
|
||||||
'summary': 'Automated backups, optimized from auto_backup of Yenthe Van Ginneken',
|
'summary': 'Automated backups, optimized from auto_backup of Yenthe Van Ginneken',
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,9 @@ _logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class AppAutoBackup(http.Controller):
|
class AppAutoBackup(http.Controller):
|
||||||
|
|
||||||
@http.route("/download/backupfile/<path:file_path>", type="http", auth="user")
|
@http.route("/dbbackup/download/<path:file_path>", type="http", auth="user")
|
||||||
def download_backupfile(self, file_path, **kw):
|
def download_backupfile(self, file_path, **kw):
|
||||||
|
_logger.warning('download_backupfile: %s', file_path)
|
||||||
if os.path.exists(file_path):
|
if os.path.exists(file_path):
|
||||||
try:
|
try:
|
||||||
with open(file_path, 'rb') as file:
|
with open(file_path, 'rb') as file:
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ class DbBackup(models.Model):
|
|||||||
rec.backup_details_ids.create({
|
rec.backup_details_ids.create({
|
||||||
'name': bkp_file,
|
'name': bkp_file,
|
||||||
'file_path': file_path,
|
'file_path': file_path,
|
||||||
'url': '/download/backupfile/%s' % file_path,
|
'url': '/dbbackup/download%s' % file_path,
|
||||||
'db_backup_id': rec.id,
|
'db_backup_id': rec.id,
|
||||||
})
|
})
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
|
|||||||
Reference in New Issue
Block a user