13
votes

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 default backup in manage databases, but I should be able to do it from within while logged in.

Is there any way to achieve this? I do know that this is possible from outside odoo using bash but thats not what I want.

9

9 Answers

8
votes

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.

4
votes

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.

3
votes

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
2
votes

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
1
votes

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).

1
votes

Go to your_odoo_instance/web/database/manager where you can see all your installed databases:

Odoo's Database Manager - Backup

You will need your defined master password for this task. If you can't remember it, have a look at your odoo.conf file in your server and check the 'admin_passwd' entry.

0
votes

There are a lot of ways to dump the database of ODOO. You can download apps from the ODOO store for doing this automatically also. Here I can suggest an addon that will do this DATABASE AUTO Backup according to your settings Month, Day, Hour basis. This is a highly reliable and efficient way where this module can handle large databases without effecting odoo processes. ODOO DATABASE AUTOMATIC BACKUP

0
votes

Use This Module For Automatic Backup

Active developer mode. Go Settings > General Settings > Database Backup Set your database name and path where you want to save your database.

https://apps.odoo.com/apps/modules/11.0/db_backup/

https://apps.odoo.com/apps/modules/14.0/yodoo_easy_backup/

-2
votes

For backup, you can go to this link http://localhost:8069/web/database/manager.

  • You can create a backup from there.
  • You can restore your pre existing backup also.

Important- Before that just set your master password for your Database to avoid consequences in future.

enter image description here If you want to change particular models or fields while logged in. You can do it by export/import action provided by Odoo. After exporting data from local you can import it on your server for that you have to validate it. enter image description here