Odoo Help

1

0
5 Answers
1
Avatar

Yogesh

--Yogesh--

1049
| 5 3 10
Delhi, India
--Yogesh--

Nothing to say .... :)

Yogesh
6/28/15, 9:09 AM


You can use t-att-attribute_name to add an attribute try like:

<span itemprop="image" t-field="product.image" t-att-alt="product.name" t-field-options="{"widget": "image", "class": "product_detail_img shadow"}" ></span>

Edit:

Even if "alt" attribute is added you won't be able to see it on form, because on form it is never a case when there is no image, when you upload an image or give a wrong src for image(which doesn't exist) Odoo replaces that image to a default image which resides in "/web/static/src/img/placeholder.png" but it works well in Reports.
2 Comments
Vasiliy
6/29/15, 4:38 AM

When added t-att-alt=”product.name” got the 500 error Error message: 'ascii' codec can't decode byte 0xd0 in position 23: ordinal not in range(128)

IMHO it is because the product is used.name in Russian. Tried to add the t-att-alt=”product.name” Received: That is, the attribute is not added neither span nor in img
Vasiliy
6/29/15, 4:40 AM

When added t-att-alt=”product.name” got the 500 error Error message: 'ascii' codec can't decode byte 0xd0 in position 23: ordinal not in range(128) span itemprop="image" t-field="product.image" t-att-alt="product.name" t-field-options="{"widget": "image", "class": "product_detail_img shadow"}"/ IMHO it is because the product is used.name in Russian. Tried to add the t-att-alt=”product.name” Received: span itemprop="image" data-oe-model="product.template" data-oe-id="21259" data-oe-field="image" data-oe-type="image" data-oe-expression="product.image" data-oe-translate="0" img class="img img-responsive product_detail_img shadow" src="/website/image/product.template/21259_21735ca/image" style="" /span That is, the attribute is not added neither span nor in img

0
ddashcool@gmail.com
4/2/19, 7:31 AM

If you want to add alt attribute for seo porposes. Add attribute alt-field in t-options.

 <span itemprop="image" t-attf-content="{{request.httprequest.url_root}}web/image/trending.template/{{trending.id}}/image" t-field="trending.image" t-options="{'widget': 'image','alt-field': 'name'}" t-att-alt="trending.name" />



0
Thomas Pigneur
3/21/19, 1:45 PM

thanks for the tip but as the alt attribute is included between span tags (and not img tags) this is not usefull for seo purposes

Ask a Question
Writer
Keep Informed
2 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now