[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
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -400,13 +400,13 @@
|
||||
<div class="col-sm-7">
|
||||
<span itemprop="image" t-field="product.image" t-options="{'widget': 'image', 'class': 'product_detail_img', 'alt-field': 'name', 'zoom': 'image'}" groups="!website_sale.group_website_multi_image"/>
|
||||
<t groups="website_sale.group_website_multi_image">
|
||||
<t t-set="variant_img" t-value="product.product_variant_ids[0].image_variant"/>
|
||||
<t t-set="variant_img" t-value="product.product_variant_id.image_variant"/>
|
||||
<t t-set="image_ids" t-value="product.product_image_ids"/>
|
||||
<div id="o-carousel-product" class="carousel slide" data-ride="carousel" data-interval="0">
|
||||
<div class="carousel-outer">
|
||||
<div class="carousel-inner">
|
||||
<div class="item active" itemprop="image" t-field="product.product_variant_ids[0].image" t-options='{"widget": "image", "class": "product_detail_img js_variant_img", "alt-field": "name", "zoom": "image"}'/>
|
||||
<div t-if="variant_img" class="item" itemprop="image" t-field="product.image" t-options='{"widget": "image", "class": "product_detail_img", "alt-field": "name", "zoom": "image"}'/>
|
||||
<div class="item active" itemprop="image" t-field="product.product_variant_id.image" t-options="{'widget': 'image', 'class': 'product_detail_img js_variant_img', 'alt-field': 'name', 'zoom': 'image', 'unique': product['__last_update'] + product.product_variant_id['__last_update']}"/>
|
||||
<div t-if="variant_img" class="item" itemprop="image" t-field="product.image" t-options="{'widget': 'image', 'class': 'product_detail_img', 'alt-field': 'name', 'zoom': 'image', 'unique': product['__last_update'] + product.product_variant_id['__last_update']}}"/>
|
||||
<t t-if="len(image_ids)" t-foreach="image_ids" t-as="pimg">
|
||||
<div class="item" t-field="pimg.image" t-options='{"widget": "image", "class": "product_detail_img", "alt-field": "name", "zoom": "image" }'/>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user