Skip to content

[19.0] [FIX] fs_attachment: ignore missing files when migrating to object storage#555

Open
ivantodorovich wants to merge 1 commit intoOCA:19.0from
camptocamp:19.0-fix-fs-attachment-force-ignore-missing
Open

[19.0] [FIX] fs_attachment: ignore missing files when migrating to object storage#555
ivantodorovich wants to merge 1 commit intoOCA:19.0from
camptocamp:19.0-fix-fs-attachment-force-ignore-missing

Conversation

@ivantodorovich
Copy link
Contributor

@ivantodorovich ivantodorovich commented Feb 12, 2026

In the event an attachment's file is not present in the filestore, Odoo would log an error and return an empty file content: b'' upon reading it's datas.

During a migration to the object storage, that would cause an empty file to be uploaded to the object storage, and the original attachment's checksum to be overwritten with the checksum of the empty file.

This commit fixes this by checking if the file exists before attempting to migrate it, ignoring it otherwise.

@OCA-git-bot
Copy link
Contributor

Hi @lmignon,
some modules you are maintaining are being modified, check this out!

@ivantodorovich ivantodorovich force-pushed the 19.0-fix-fs-attachment-force-ignore-missing branch 2 times, most recently from e6074ca to a28157f Compare February 12, 2026 12:25
…orage

In the event an attachment's file is not present in the filestore, Odoo would
log an error and return an empty file content: b'' upon reading it's `datas`.

During a migration to the object storage, that would cause an empty file to be
uploaded to the object storage, and the original attachment's checksum to be
overwritten with the checksum of the empty file.

This commit fixes this by checking if the file exists before attempting to
migrate it, ignoring it otherwise.
@ivantodorovich ivantodorovich force-pushed the 19.0-fix-fs-attachment-force-ignore-missing branch from a28157f to cfbf6dc Compare February 12, 2026 12:42
@ivantodorovich ivantodorovich marked this pull request as ready for review February 12, 2026 12:45
@ivantodorovich ivantodorovich force-pushed the 19.0-fix-fs-attachment-force-ignore-missing branch 2 times, most recently from 39c09ba to cfbf6dc Compare March 2, 2026 12:20
@ivantodorovich ivantodorovich changed the title [FIX] fs_attachment: ignore missing files when migrating to object storage [19.0] [FIX] fs_attachment: ignore missing files when migrating to object storage Mar 2, 2026
@lmignon
Copy link
Contributor

lmignon commented Mar 2, 2026

unfortunately tests are 🔴

@ivantodorovich
Copy link
Contributor Author

Yeap, it's failing in other PRs as well. Unrelated to this one.
I'll look into it

errors that caused failure (4):
2026-03-02 12:22:23,098 335 ERROR odoo odoo.addons.fs_storage.tests.test_fs_storage: ERROR: TestFSStorage.test_interface_values
Error: Errors detected in log.
Traceback (most recent call last):
  File "/__w/storage/storage/fs_storage/tests/test_fs_storage.py", line 141, in test_interface_values
    with Form(self.env["fs.storage"]) as new_storage:
  File "/opt/odoo/odoo/tests/form.py", line 143, in __init__
    self._init_from_defaults()
  File "/opt/odoo/odoo/tests/form.py", line 339, in _init_from_defaults
    self._perform_onchange()
  File "/opt/odoo/odoo/tests/form.py", line 579, in _perform_onchange
    result = record.onchange(values, field_names, self._view['fields_spec'])
  File "/opt/odoo/odoo/orm/models.py", line 6994, in onchange
    raise NotImplementedError("onchange() is implemented in module 'web'")
NotImplementedError: onchange() is implemented in module 'web'

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.

5 participants