Some iPhone users upload HEIC files with a ``.jpg`` extension. Odoo stores
the file as-is, but the mimetype is detected as ``image/...``, so the code
enters the image processing branch. ``reportlab``'s ``ImageReader`` relies
on ``PIL.Image.open()`` which cannot identify HEIC files without an explicit
plugin, causing a ``PIL.UnidentifiedImageError`` and a 500 error on report
download.
Fix by:
- Registering the ``pillow-heif`` opener at module load time (optional
dependency, silently ignored if not installed) so that Pillow can decode
HEIC/HEIF images.
- Converting any image to JPEG in memory via Pillow before passing it to
``ImageReader``, bypassing ``reportlab``'s own format detection entirely.
- Wrapping the image block in a ``try/except`` to gracefully skip
attachments that cannot be decoded, consistent with the existing PDF
error handling.