diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2019-10-03 10:12:42 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2019-10-08 08:17:05 +0000 |
| commit | 030f2654a5c472229d20e283072bd76a5b1439cc (patch) | |
| tree | 2391f97228dfa3f3e89a6fef6ba16be81e81ab6f /addons/web/models | |
| parent | e42aa1e34462256fcd17015f32cebd5f4f79df5e (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
Diffstat (limited to 'addons/web/models')
| -rw-r--r-- | addons/web/models/ir_qweb.py | 5 |
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 |
