From e88f91ba41d6af028df019893d656a5f50b35d28 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Tue, 29 Aug 2017 14:34:26 +0200 Subject: [PATCH] [FIX] web_editor, website_sale: load images of the shop when product has been updated Before this commit, when the shop was in multi images, the main image was not refreshed when changed in the back end. This was because of the ?unique parameter that was computed on the product variant image. Hence, when the product image changed, the variant image did not, the hash neither, and the image wasn't refreshed This commit fixes this by adding an option to the qweb.field.image OPW 765287 closes #19133 --- addons/web_editor/models/ir_qweb.py | 2 +- addons/website_sale/views/templates.xml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/web_editor/models/ir_qweb.py b/addons/web_editor/models/ir_qweb.py index 751767800d6..64746898b79 100644 --- a/addons/web_editor/models/ir_qweb.py +++ b/addons/web_editor/models/ir_qweb.py @@ -293,7 +293,7 @@ class Image(models.AbstractModel): if max_width or max_height: max_size = '%sx%s' % (max_width, max_height) - sha = hashlib.sha1(getattr(record, '__last_update')).hexdigest()[0:7] + sha = hashlib.sha1(options.get('unique', getattr(record, '__last_update'))).hexdigest()[0:7] max_size = '' if max_size is None else '/%s' % max_size src = '/web/image/%s/%s/%s%s?unique=%s' % (record._name, record.id, field_name, max_size, sha) diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index 97ad41ab074..f0e1a756263 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -400,13 +400,13 @@
- +