[18.0][ADD] storage_file: swap backend wizard#622
Open
simahawk wants to merge 7 commits into
Open
Conversation
henrybackman
approved these changes
May 28, 2026
Contributor
Author
|
Slightly reworked to support jobs via |
SilvioC2C
approved these changes
May 28, 2026
Contributor
SilvioC2C
left a comment
There was a problem hiding this comment.
Overall LGTM, a few suggestions
Add a "Swap Storage Backend" wizard in `storage_file` to move one or more `storage.file` records between backends. Triggered via an `ir.actions.server` bound to `storage.file` list/form views, so it works on multi-selection from the Action menu. The wizard is pre-filled with the current selection's backend as source and refuses any selection spanning multiple backends. The destination domain excludes the source. On apply, `storage.file._swap_backend(new_backend)`: * downloads the binary from the old backend, * uploads to the new one (recomputing `relative_path` from the destination `filename_strategy`), * updates `backend_id` and `relative_path`, * schedules deletion of the old physical file via `cr.postcommit`, so the original is removed only if the transaction commits. On rollback the source file is preserved. Records already on the destination are skipped. The wizard exposes a `_resolve_file_ids(active_model, active_ids)` hook so submodules can map their own records to the underlying `storage.file` ids. `storage_image` and `storage_media` will register server actions on their models that reuse the base wizard.
* drop the postcommit part * make it hookable so that for big batches of files we can rely on queue_job
33b2c01 to
554c826
Compare
Allow delegation of big batch of files to queue jobs.
In case you change the backend directly from form or not.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a "Swap Storage Backend" wizard in
storage_fileto move one ormore
storage.filerecords between backends. Triggered via anir.actions.serverbound tostorage.filelist/form views, so itworks on multi-selection from the Action menu.
The wizard is pre-filled with the current selection's backend as
source and refuses any selection spanning multiple backends. The
destination domain excludes the source.
On apply,
storage.file._swap_backend(new_backend):relative_pathfrom thedestination
filename_strategy),backend_idandrelative_path,cr.postcommit,so the original is removed only if the transaction commits. On
rollback the source file is preserved.
Records already on the destination are skipped.
The wizard exposes a
_resolve_file_ids(active_model, active_ids)hook so submodules can map their own records to the underlying
storage.fileids.storage_imageandstorage_mediawill registerserver actions on their models that reuse the base wizard.
An additional module
storage_file_swap_backend_queueoffers the ability to swap big batches of file via jobs.