Skip to content

[16.0][FIX] shopfloor: add unique parameter to product image URL - #1238

Open
lmignon wants to merge 1 commit into
OCA:16.0from
acsone:16.0-shopfloor-product-image-url-unique
Open

[16.0][FIX] shopfloor: add unique parameter to product image URL#1238
lmignon wants to merge 1 commit into
OCA:16.0from
acsone:16.0-shopfloor-product-image-url-unique

Conversation

@lmignon

@lmignon lmignon commented Aug 5, 2026

Copy link
Copy Markdown

The change adds a unique parameter to the product image URL, which is generated using a SHA-512 hash of the product's last update timestamp. This ensures that when a product image is updated, the URL will change, preventing caching issues and ensuring that users always see the most recent image.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @guewen, @sebalix, @simahawk,
some modules you are maintaining are being modified, check this out!

@lmignon

lmignon commented Aug 5, 2026

Copy link
Copy Markdown
Author

ping @jbaudoux

@lmignon
lmignon force-pushed the 16.0-shopfloor-product-image-url-unique branch from 51a6197 to 2d04511 Compare August 5, 2026 13:39
Comment thread shopfloor/actions/data_detail.py Outdated
return None
return f"/web/image/product.product/{record.id}/{field_name}"
sha = hashlib.sha512(
str(getattr(record, "__last_update")).encode("utf-8") # noqa: B009

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

is it necessary to use getattr?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is the kind of mistake that can happen when taking inspiration from Odoo's code without enough critical distance. https://github.com/odoo/odoo/blob/16.0/addons/web/models/ir_qweb_fields.py#L39

It's now changed and the code should be compatible with Odoo up to 19.0. (where '__last_update' no more exists)

@lmignon
lmignon force-pushed the 16.0-shopfloor-product-image-url-unique branch 2 times, most recently from 89266a7 to c7f49df Compare August 7, 2026 07:32
The change adds a unique parameter to the product image URL, which is
generated using a SHA-512 hash of the product's last update timestamp.
This ensures that when a product image is updated, the URL will change,
preventing caching issues and ensuring that users always see the most
recent image.
@lmignon
lmignon force-pushed the 16.0-shopfloor-product-image-url-unique branch from c7f49df to 5767fd2 Compare August 7, 2026 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants