Skip to content

[18.0][IMP] storage_[file|media|image]: improve replace file wizard - #675

Open
simahawk wants to merge 7 commits into
OCA:18.0from
camptocamp:18-fix-media-replace-active
Open

simahawk wants to merge 7 commits into
OCA:18.0from
camptocamp:18-fix-media-replace-active

Conversation

@simahawk

@simahawk simahawk commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Replace file wizard: optionally keep the replaced file as history

The storage_file replace wizard can now keep an archived copy of the record that owns the replaced file (keep_history), linked to the same records (keep_relations).

The other modules are adapted to use it. See the commits for details.

@OCA-git-bot OCA-git-bot added series:18.0 mod:storage_media Module storage_media mod:storage_file Module storage_file mod:storage_image Module storage_image mod:storage_media_product Module storage_media_product mod:storage_image_product Module storage_image_product labels Oct 1, 2026
@simahawk
simahawk force-pushed the 18-fix-media-replace-active branch from da7937e to 75201ca Compare October 1, 2026 19:20
Was mispelled and not really meaningful.
Avoid full break with corrupted files, just log an error.
Add 'keep_history' and 'keep_relations' options to the replace wizard,
with the shared logic to copy and archive the record owning the
replaced file, and hooks to handle its relations.

Provide a base form for the wizard, to extend by the modules defining
the records owning files.

Without 'keep_history', the replaced file is dropped: nothing refers to
it anymore.

The copy reuses the old file and its backend: otherwise the creation
writes the default backend on the reused file, which moves it.
Use the shared replace logic from storage_file and extend its wizard
form.

Drop the explicit '_inverse_data' call: creating the file with its
data already stores it on the backend.
Use the shared replace logic from storage_file and extend its wizard
form.
On file replacement, copy the product relations and the categories
of the media to its archived copy when 'keep_relations' is set.
On file replacement, copy the product and category relations of the
image to its archived copy when 'keep_relations' is set.
@simahawk
simahawk force-pushed the 18-fix-media-replace-active branch from 75201ca to cc126cb Compare October 2, 2026 12:48
@OCA-git-bot OCA-git-bot added the mod:storage_file_swap_backend_queue Module storage_file_swap_backend_queue label Oct 2, 2026
@simahawk
simahawk marked this pull request as ready for review October 6, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:storage_file_swap_backend_queue Module storage_file_swap_backend_queue mod:storage_file Module storage_file mod:storage_image_product Module storage_image_product mod:storage_image Module storage_image mod:storage_media_product Module storage_media_product mod:storage_media Module storage_media series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants