-
-
Notifications
You must be signed in to change notification settings - Fork 167
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
Conversation
Hi @lmignon, |
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: |
There was a problem hiding this comment.
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.
92fa63c
to
b1b6c03
Compare
There was a problem hiding this 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)
@kafai-lam Can you rebase and fix the conflict plz. Once done, I'll proceed to the merge. |
b1b6c03
to
705250d
Compare
@lmignon Resolved conflicts in the test cases with rebase |
Thank you. |
/ocabot merge minor |
This PR looks fantastic, let's merge it! |
Congratulations, your PR was merged at e27899e. Thanks a lot for contributing to OCA. ❤️ |
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.