shopinvader / odoo-shopinvader

Odoo Modules. Sorry Magento, Shopinvader is coming
GNU Affero General Public License v3.0
121 stars 104 forks source link

[13.0] shopinvader_image: Keep original url_key if found in product(categories) #923

Closed HviorForgeFlow closed 3 years ago

HviorForgeFlow commented 3 years ago

My use case is the next: I have a database + filestore with all images from products as storage images. I didn't take the default sluglify display_name that shopinvader adds by default. In particular I used (internal reference)-tag_image-(*optional variant_id).

I noticed that shopinvader_image module are generating thumbnails taking sluglify display_name, but I would like to keep my filename + resize on that cases.

I see this part of code, that seems responsible of it: https://github.com/shopinvader/odoo-shopinvader/blob/e701007070dd24f981c66b8352bd8f2e18d5589a/shopinvader_image/models/shopinvader_image_mixin.py#L53-L73

Could be possible that if a storage.image is already found in product, we reuse their url for the original image + resize format?

@simahawk

simahawk commented 3 years ago

@HviorForgeFlow in theory you should change the method to consider your attributes, then recompute the hash for all those records so that is not recomputed. Then, change _get_image_url_key to use those attributes.

HviorForgeFlow commented 3 years ago

Yes! sorry that day I was so obfuscated :smile: