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

Display image in QWeb report

By
Victor Godayer
on 2/17/15, 7:07 AM 5,762 views

Hi,

 

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

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>

 

 

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.

Does anyon has already faced this issue ?

 

Thank you for your help

 

2

Ankit H Gandhi(AHG)

--Ankit H Gandhi(AHG)--
996
| 5 3 6
Rajkot, India
--Ankit H Gandhi(AHG)--

Learning Python..

Ankit H Gandhi(AHG)
On 2/17/15, 7:26 AM

Hello Victor,



remove this line

<img t-att-src="'data:image/jpeg;base64,/var/www/cbl_openerp/openerp/cap_addons/cap_sale/img/footer.jpeg'"/>

Your image should be saved inside static/src/img/image name

Try this code hope very help full.

<img src='/module name/static/src/img/image name with extention' style="max-height: 45px;"/>

if you find this answer helpful, please give me a thumbs up vote    

Thanks & Regards,

Ankit H Gandhi

HI, thanks for your help. I tried your solution, but it didn't change anything. I still can't see any image in the pdf generated...

Victor Godayer
on 2/17/15, 8:33 AM

update code.@Victor

Ankit H Gandhi(AHG)
on 2/17/15, 11:58 PM

Upgrading the module after restarting the server may work.

Rutul Raval (rra)
on 10/26/15, 5:55 AM
0
Dasadiya Chaitanya
On 2/20/15, 8:09 AM

The Below link should helpful for solve your Question

http://stackoverflow.com/questions/28561121/display-image-in-qweb-report/28628727#28628727

 

I hope this should helful for you ..:)

 

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: 2/17/15, 7:07 AM
Seen: 5762 times
Last updated: 10/20/16, 6:22 AM