Skip to content

Commit

Permalink
⚡ odoo_backup_sh_google_disk: implemented backup downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
em230418 committed Aug 13, 2019
1 parent 569de60 commit 7872d83
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions odoo_backup_sh_google_disk/models/odoo_backup_sh.py
Expand Up @@ -126,6 +126,17 @@ class BackupInfo(models.Model):

storage_service = fields.Selection(selection_add=[('google_drive', 'Google Drive')])

@api.multi
def download_backup_action(self):
obj = self.env[self._inherit].search([('id', '=', self._context['active_id'])])
obj.ensure_one()
file_id = self.env["odoo_backup_sh.config"].get_google_drive_file_id(obj.backup_filename)
return {
"type": "ir.actions.act_url",
"url": "https://drive.google.com/uc?id={}&export=download".format(file_id),
"target": "self",
}


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

0 comments on commit 7872d83

Please sign in to comment.