summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2019-10-03 10:12:42 +0000
committerNicolas Martinelli <nim@odoo.com>2019-10-08 08:17:05 +0000
commit030f2654a5c472229d20e283072bd76a5b1439cc (patch)
tree2391f97228dfa3f3e89a6fef6ba16be81e81ab6f
parente42aa1e34462256fcd17015f32cebd5f4f79df5e (diff)
[IMP] web: add support for itemprop on img
Take the following QWeb snippet: ``` <div t-field="product.image" itemprop="image" t-options="{'widget': 'image'}"/> ``` When the image is rendered, the `itemprop="image"` remains on the `<div>` tag, it is not set on the `<img>` tag. We add the support of the `itemprop` option, so it can be added to the `<img>` tag: ``` <div t-field="product.image" t-options="{'widget': 'image', 'itemprop': 'image'}"/> ``` opw-2076934
-rw-r--r--addons/web/models/ir_qweb.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/addons/web/models/ir_qweb.py b/addons/web/models/ir_qweb.py
index 1083916ebf5..211dc9bea6e 100644
--- a/addons/web/models/ir_qweb.py
+++ b/addons/web/models/ir_qweb.py
@@ -69,8 +69,13 @@ class Image(models.AbstractModel):
elif options.get('zoom'):
src_zoom = options['zoom']
+ itemprop = None
+ if options.get('itemprop'):
+ itemprop = options['itemprop']
+
atts = OrderedDict()
atts["src"] = src
+ atts["itemprop"] = itemprop
atts["class"] = classes
atts["style"] = options.get('style')
atts["alt"] = alt