Odoo Help

Welcome!

This community 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.

0

How to display images for non-admin website users ?

By
PY
on 7/1/15, 5:53 AM 691 views

Hi !

In my website, I declared a field like this

<template id="transporter_image" inherit_id="website_sale.payment">
<xpath expr="//div[@id='delivery_carrier']//input" position="after">
<span itemprop="image" t-field="delivery.partner_id.image"
t-field-options='{"widget": "image"}' style="display: inline-block;"/>
</xpath>
</template>

As Admin, this renders like

<span itemprop="image" style="display: inline-block;" data-oe-id="864"
data-oe-source-id="841" data-oe-xpath="/data/xpath/span"
data-oe-model="ir.ui.view" data-oe-field="arch" data-oe-type="image"
data-oe-expression="delivery.partner_id.image" data-oe-translate="0">
<img class="img img-responsive" src="/website/image/res.partner/6_8994a20/image" style="">
</span>

As an external user, it looks like this:

<span itemprop="image" style="display: inline-block;">
<img class="img img-responsive" src="/website/image/res.partner/6_8994a20/image" style="">
</span>

and thus, the image is not being rendered.


How to solve this ?

1
PY
On 7/1/15, 8:34 AM

Workaround that does the job:

<template id="transporter_image" inherit_id="website_sale.payment">
<xpath expr="//div[@id='delivery_carrier']//input" position="after">
<img itemprop="image" class="img img-responsive" style="display: inline-block;"
t-att-src="'data:image/png;base64,' + delivery.partner_id.image"/>
</xpath>
</template>

I will use it until I find a better alternative.

Good answer

shameem@aχoncoms
on 8/31/16, 6:59 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/1/15, 5:53 AM
Seen: 691 times
Last updated: 7/1/15, 8:34 AM