Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][FIX] allow serving field attachment with fs stream #414

Merged
merged 1 commit into from
Nov 10, 2024

Conversation

kafai-lam
Copy link
Contributor

Current Issue: After the force_storage step is complete and the default file storage (fs.storage) is set, images are automatically migrated to use fs.attachment. However, image model fields such as image_128 and image_512 are not being served correctly by ir.binary. This PR aims to address this problem.

Proposed Solution: In the IrBinary._get_image_stream_from method, it is recommended to add a field attachment handler for binary fields when they are found to use fs.attachment. This should ensure that image fields are served properly.

@OCA-git-bot
Copy link
Contributor

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

record.check_field_access_rights("read", [field_name])
field_def = record._fields[field_name]
if field_def.attachment and not field_def.compute and not field_def.related:
field_attachment = (
if field_def.attachment and field_def.store:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed the condition from "is not computed and not related" to "is stored". For instance, all image_64 and image_128 fields, defined by the image.mixin model, are computed fields but still have an actual record in ir.attachment.

This update may also help address the question raised in #411.

@kafai-lam kafai-lam force-pushed the 17.0-serving-field-attachment branch 6 times, most recently from 92fa63c to b1b6c03 Compare November 5, 2024 18:00
Copy link
Contributor

@lmignon lmignon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kafai-lam Thank you for the fix. The code LGTM (code review only)

@lmignon
Copy link
Contributor

lmignon commented Nov 10, 2024

@kafai-lam Can you rebase and fix the conflict plz. Once done, I'll proceed to the merge.

@kafai-lam kafai-lam force-pushed the 17.0-serving-field-attachment branch from b1b6c03 to 705250d Compare November 10, 2024 08:51
@kafai-lam
Copy link
Contributor Author

@lmignon Resolved conflicts in the test cases with rebase

@lmignon
Copy link
Contributor

lmignon commented Nov 10, 2024

@lmignon Resolved conflicts in the test cases with rebase

Thank you.

@lmignon
Copy link
Contributor

lmignon commented Nov 10, 2024

/ocabot merge minor

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 17.0-ocabot-merge-pr-414-by-lmignon-bump-minor, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 067ff4f into OCA:17.0 Nov 10, 2024
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at e27899e. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants