如何在QWeb报告中显示图像? [英] How to display an image in a QWeb report?

查看:69
本文介绍了如何在QWeb报告中显示图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我扩展了"report.external_layout_footer" qweb视图以显示图像.

I extended the 'report.external_layout_footer' qweb view to display image.

以下是我的代码在"reports/external_layout.xml"文件中:

Below is my code in the file reports/external_layout.xml:

    <template id="report_footer_custom" inherit_id="report.external_layout_footer">
        <xpath expr="//div[@class='footer']" position="replace">
            <div class="footer">
                    <img t-att-src="'data:image/jpeg;base64,/var/www/cbl_openerp/openerp/cap_addons/cap_sale/img/footer.jpeg'"/>
                    <ul class="list-inline">
                        <li>Page:</li>
                        <li>
                            <span class="page"/>
                        </li>
                        <li>/</li>
                        <li>
                            <span class="topage"/>
                        </li>
                    </ul>
                </div>
        </xpath>
    </template>

这是我的 openerp .py内容:

And here is my openerp.py content :

...
"depends": ["base","sale","report"],
...
"data": ['sale.xml',
        'reports/reports.xml',
        'reports/external_layout.xml',
        'reports/informations_prestation.xml',
        'views/product_template.xml',
        'filter.xml'],
...
"images":['img/footer.jpeg',],
...

但是当我打印销售订单时,我无法在页面底部查看图像.

But when I print a sale order, i can't view my image at the bottom of the page.

有人有什么建议吗?

推荐答案

只需尝试以下代码,并从模块中设置图像路径并运行它.

Just try this below code and set the image path from your module and run it .

<template id="report_footer_custom"inherit_id="report.external_layout_footer">
    <xpath expr="//div[@class='footer']" position="replace">
        <div class="footer">
            <img class="img img-responsive" src="/sale_order_report/static/src/img/header.jpg"/>
            <ul class="list-inline">
                <li>Page:</li>
                <li><span class="page"/></li>
                <li>/</li>
                <li><span class="topage"/></li>
            </ul>
        </div> 
    </xpath>
</template>

在QWeb报表自定义页脚中,我的工作正常

My side its working fine in the QWeb Report Custom Footer

这篇关于如何在QWeb报告中显示图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆