[19.0][FIX] database_cleanup: create attachment with store_fname in test#3486
Merged
OCA-git-bot merged 1 commit intoOCA:19.0from Jan 4, 2026
Merged
Conversation
Tests break on test attachment created without store_fname when `mail` is installed. In that case, attachments are actively deleted when a model is unlinked, and the missing store_fname causes problems further down. https://github.com/odoo/odoo/blob/d2274a3fdb/addons/mail/models/ir_model.py#L50-L68 Fixes ``` 2026-01-02 20:25:20,571 385 ERROR odoo odoo.tests.suite: ERROR: tearDownClass (odoo.addons.database_cleanup.tests.test_purge_fields.TestCleanupPurgeFields) Traceback (most recent call last): File "/__w/server-tools/server-tools/database_cleanup/tests/test_purge_fields.py", line 65, in tearDownClass model.unlink() File "/opt/odoo/addons/mail/models/ir_model.py", line 68, in unlink self.env['ir.attachment']._file_delete(fname) File "/opt/odoo/odoo/addons/base/models/ir_attachment.py", line 162, in _file_delete self._mark_for_gc(fname) File "/opt/odoo/odoo/addons/base/models/ir_attachment.py", line 167, in _mark_for_gc fname = re.sub('[.:]', '', fname).strip('/\\') File "/usr/lib/python3.10/re.py", line 209, in sub return _compile(pattern, flags).sub(repl, string, count) TypeError: expected string or bytes-like object ```
1 task
Contributor
|
This PR looks fantastic, let's merge it! |
Contributor
|
Congratulations, your PR was merged at 36d97f7. Thanks a lot for contributing to OCA. ❤️ |
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.
Tests break on test attachment created without store_fname when
mailis installed. In that case, attachments are actively deleted when a model is unlinked, and the missing store_fname causes problems further down.https://github.com/odoo/odoo/blob/d2274a3fdb/addons/mail/models/ir_model.py#L50-L68
Fixes
(E.g. in https://github.com/OCA/server-tools/actions/runs/20666022004/job/59338358298?pr=3484)