[FIX] web_editor: avoid fetching optimized images which can't be shown
Before this commit, when opening the media dialog, the optimized images
would be fetched too.
An optimized image is an image related to an original one which received
some modification (crop etc).
Those optimized images are hidden by default, and can only be shown when
toggling the "Show optimized" option, which can be shown only in debug
mode.
So, fetching those images outside debug mode is:
1. Useless, as we don't do anything with those and never show them
2. Buggy sometimes, as a full patch of "Load more" images could be
composed of only optimized images, meaning the "load more" will
actually look like it did nothing, as all received images are (and
will remain) hidden.
There is a tiny exception: if the edited image is an optimized one, we
still need to fetch it's attachment so we can show this image in the
media dialog as selected.
This fix thus filter out all the optimized images (except the one from
the explained exception) from the `search_read()`.
opw-3372811
closes odoo/odoo#126817
Signed-off-by:
Quentin Smetz (qsm) <qsm@odoo.com>
Loading
Please register or sign in to comment