Skip to content

Commit

Permalink
⚡ odoo_backup_sh_dropbox: implemented downloading backups
Browse files Browse the repository at this point in the history
  • Loading branch information
em230418 committed Aug 13, 2019
1 parent 9cb6873 commit 569de60
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions odoo_backup_sh_dropbox/models/odoo_backup_sh.py
Expand Up @@ -124,6 +124,18 @@ class BackupInfo(models.Model):

storage_service = fields.Selection(selection_add=[('dropbox', 'Dropbox')])

@api.multi
def download_backup_action(self):
obj = self.env[self._inherit].search([('id', '=', self._context['active_id'])])
obj.ensure_one()
folder_path = self.env['ir.config_parameter'].get_param("odoo_backup_sh_dropbox.dropbox_folder_path") or ""
DropboxService = self.env['ir.config_parameter'].get_dropbox_service()
return {
"type": "ir.actions.act_url",
"url": DropboxService.files_get_temporary_link("{0}/{1}".format(folder_path, obj.backup_filename)).link,
"target": "self",
}


class BackupRemoteStorage(models.Model):
_inherit = 'odoo_backup_sh.remote_storage'
Expand Down

0 comments on commit 569de60

Please sign in to comment.