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 load an image file from disk in qweb report?

By
NSC
on 7/20/15, 5:45 PM 1,116 views

I need to overlap an image with text in my report. "Normal" html code like that does not work - the image is not shown at all:

 <template id="external_layout_header">
<div class="header">
<table width="22cm" border="1" height="30cm">
<tr background="logo.jpg">
<div><span t-field="company.partner_id"/></div>
<div><span t-field="company.zip"/> <span t-field="company.city"/></div>
</tr>
</table>
</div>
</template>

It seems to me, that qweb is unable to load images from disk. Even if I provide absolute path for the image, it is not shown neither in html nor in pdf. I get the following error:


2015-07-20 21:39:56,306 12436 ERROR TEST_DB openerp.addons.website.models.ir_http: 500 Internal Server Error:

Traceback (most recent call last):

File "/opt/odoo/odoo8/addons/website/models/ir_http.py", line 199, in _handle_exception

response = super(ir_http, self)._handle_exception(exception)

File "/opt/odoo/odoo8/openerp/addons/base/ir/ir_http.py", line 147, in _handle_exception

return request._handle_exception(exception)

File "/opt/odoo/odoo8/openerp/http.py", line 666, in _handle_exception

return super(HttpRequest, self)._handle_exception(exception)

File "/opt/odoo/odoo8/openerp/addons/base/ir/ir_http.py", line 173, in _dispatch

result = request.dispatch()

File "/opt/odoo/odoo8/openerp/http.py", line 684, in dispatch

r = self._call_function(**self.params)

File "/opt/odoo/odoo8/openerp/http.py", line 310, in _call_function

return checked_call(self.db, *args, **kwargs)

File "/opt/odoo/odoo8/openerp/service/model.py", line 113, in wrapper

return f(dbname, *args, **kwargs)

File "/opt/odoo/odoo8/openerp/http.py", line 307, in checked_call

return self.endpoint(*a, **kw)

File "/opt/odoo/odoo8/openerp/http.py", line 803, in __call__

return self.method(*args, **kw)

File "/opt/odoo/odoo8/openerp/http.py", line 403, in response_wrap

response = f(*args, **kw)

File "/opt/odoo/odoo8/addons/report/controllers/main.py", line 49, in report_routes

docids = [int(i) for i in docids.split(',')]

ValueError: invalid literal for int() with base 10: 'logo.jpg'

Why does it look for an integer when reading name/path for the image? Is this a known bug? Can somebody confirm that Odoo v8 / qweb is unable to load resource files from disk?


0
NSC
On 7/22/15, 3:50 PM

Has nobody really never loaded an image file from disk within a qweb report to explain to me how it works?

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/20/15, 5:45 PM
Seen: 1116 times
Last updated: 7/22/15, 3:50 PM