I need to backup the current db while logged into odoo. I should be able to do it using a button, so that suppose I click on the button, it works the same way as odoo defaul
Add a button somewhere and call a controller like this one.
@http.route('/backup/download', auth="user", type='http')
def backup(self, **kw):
ts = datetime.datetime.utcnow().strftime("%Y-%m-%d_%H-%M-%S")
filename = "%s_%s.zip" % (request.env.cr.dbname, ts)
headers = [
('Content-Type', 'application/octet-stream; charset=binary'),
('Content-Disposition', content_disposition(filename)),
]
dump_stream = db.dump_db(request.env.cr.dbname, None)
response = werkzeug.wrappers.Response(dump_stream, headers=headers, direct_passthrough=True)
return response
You can use a private browser session to access the Database menu, from the login screen, and perform the the backup form there (you need to know the master password to access that, defined in the server configuration file).