Skip to content

[16.0][FIX] auto_backup: allow scheduled backup when list_db is disabled#3641

Draft
klodr wants to merge 1 commit into
OCA:16.0from
klodr:16.0-fix-auto_backup-list_db
Draft

[16.0][FIX] auto_backup: allow scheduled backup when list_db is disabled#3641
klodr wants to merge 1 commit into
OCA:16.0from
klodr:16.0-fix-auto_backup-list_db

Conversation

@klodr
Copy link
Copy Markdown

@klodr klodr commented Jun 6, 2026

Problem

When list_db = False is set in the Odoo configuration, scheduled auto_backup
jobs fail with:

Database management functions blocked, admin disabled database listing

odoo.service.db.dump_db is decorated with @check_db_management_enabled, which
raises AccessDenied when list_db is False. The scheduled backup then fails
silently and leaves a zero-byte dump file — a silent data-loss risk.

Fix

Wrap the dump_db calls in action_backup() with a small context manager that
temporarily re-enables list_db for the duration of the dump and always
restores its original value (try/finally, even on error). Adds a regression
test (test_action_backup_local_list_db_disabled).

Port of #3639.

odoo.service.db.dump_db is guarded by check_db_management_enabled, which raises AccessDenied ("Database management functions blocked, admin disabled database listing") when list_db = False is set in the Odoo configuration. Scheduled backups then failed silently, leaving zero-byte files.

list_db only hides database management from the web interface; a scheduled backup is a trusted server-side operation. Re-enable the flag for the duration of the dump through a context manager that always restores its original value, even on error.

Signed-off-by: klodr <klodr@users.noreply.github.com>
@legalsylvain legalsylvain marked this pull request as draft June 6, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants