Skip to content

Syncing from upstream OCA/storage (18.0)#368

Merged
bt-admin merged 15 commits into
brain-tec:18.0from
OCA:18.0
Jun 10, 2026
Merged

Syncing from upstream OCA/storage (18.0)#368
bt-admin merged 15 commits into
brain-tec:18.0from
OCA:18.0

Conversation

@bt-admin

Copy link
Copy Markdown

bt_gitbot

simahawk and others added 15 commits June 9, 2026 16:22
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
Allow delegation of big batch of files to queue jobs.

[IMP] storage_file_swap_backend_queue: add flag to turn on/off
In case you change the backend directly from form or not.
Signed-off-by simahawk
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: storage-18.0/storage-18.0-storage_image
Translate-URL: https://translation.odoo-community.org/projects/storage-18-0/storage-18-0-storage_image/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: storage-18.0/storage-18.0-storage_media
Translate-URL: https://translation.odoo-community.org/projects/storage-18-0/storage-18-0-storage_media/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: storage-18.0/storage-18.0-storage_file
Translate-URL: https://translation.odoo-community.org/projects/storage-18-0/storage-18-0-storage_file/
@bt-admin bt-admin added the 18.0 label Jun 10, 2026
@bt-admin
bt-admin merged commit 4d79110 into brain-tec:18.0 Jun 10, 2026
4 checks passed
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.61538% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.13%. Comparing base (b668557) to head (b0f004c).
⚠️ Report is 71 commits behind head on 18.0.

Files with missing lines Patch % Lines
storage_file/models/storage_file.py 76.08% 7 Missing and 4 partials ⚠️
storage_file/wizards/swap_backend.py 78.72% 5 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             18.0     #368      +/-   ##
==========================================
+ Coverage   86.67%   87.13%   +0.46%     
==========================================
  Files         185      197      +12     
  Lines        6296     6686     +390     
  Branches      537      564      +27     
==========================================
+ Hits         5457     5826     +369     
- Misses        655      667      +12     
- Partials      184      193       +9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

4 participants