Backup Odoo db from within odoo

You can take database backup from "Database Management" in odoo..

type following link in browser,

http://localhost:8069/web/database/manager

just replace your ip and port in aboves link, you will get screen for database management, you can perform following operations related to database

  • Create
  • Duplicate
  • Drop
  • Backup
  • Password
  • Restore

You can use the CURL to download the full backup (assets + DB), this method is comparatively faster than pg_dump.

curl -X POST \
-F "master_pwd=${ADMIN_PASSWORD}" \
-F "name=${ODOO_DATABASE}" \
-F "backup_format=zip" \
-o ${BACKUP_DIR}/${ODOO_DATABASE}.$(date +%F-%T).zip \
${HOST}/web/database/backup

You can wrap inside a custom (your own) Odoo add-on if you wish to. Hope this helps.


By using this module you can backup your database periodically

https://www.odoo.com/apps/modules/7.0/crontab_config/ (v7)

you can also test this module

https://www.odoo.com/apps/modules/6.1/db_backup_ept/ (v6 it can be miggrated to v7)

in your case you can add button to execute the function that will be executed by the schedular.


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