콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
4 답글
7334 화면

I'm trying to add an image to odoo invoices as the company sign to all pages in the report, i'am added it by this way 

<template id="durar_sale_order_sign_inv" inherit_id="account.report_invoice_document">
<xpath expr="//div[@id='qrcode']" position="after">
<div class="watermark" style="position:absolute;opacity:0.25;width:100%;heights:100%;z-index:4000;">
<img style="width:200px;heights:350px;text-align:right;border-radius: 50%;" t-attf-src="data:image/*;base64,{{o.sign_img}}"/>
</div>
</xpath>
</template>
it locates the image at the correct position I want, but it placed always in the last page 
 I need it on every page in the report , so I tried this way 

<template id="report_layout" inherit_id="web.external_layout_background">
<xpath
expr="//div[hasclass('header')]" position="inside">
<div
style="position:absolute;opacity:0.25;width:100%;heights:100%;z-index:4000;">
<img
style="width:200px;heights:opacity:0.25;350px;text-align:right;border-radius: 50%;" t-attf-src="data:image/*;base64,{{o.sign_img}}"/>
</div>
</xpath>
</template>

but this put the image under the header in every page and it covered contents, so how can I place the image in right bottom and repeat it in every page 
아바타
취소
베스트 답변

Dear Mohamed Fouad,

Please try this code.

<xpath expr="//div[@class='clearfix']" position="replace">
                <div class="clearfix">
                        <div id="total" style="float:right;width:30%;">
                            <div>
                                <table class="table table-sm">
                                    <tr class="border-black o_subtotal" style="">
                                        <td><strong>Subtotal</strong></td>
                                        <td class="text-right">
                                            <span t-field="o.amount_untaxed"/>
                                        </td>
                                    </tr>
                                    <t t-foreach="o.amount_by_group" t-as="amount_by_group">
                                        <tr style="">
                                            <t t-if="len(o.tax_line_ids) == 1 and o.amount_untaxed == amount_by_group[2]">
                                                <td><span t-esc="amount_by_group[0]"/></td>
                                                <td class="text-right o_price_total">
                                                    <span t-esc="amount_by_group[3]" />
                                                </td>
                                            </t>
                                            <t t-else="">
                                                <td>
                                                    <span t-esc="amount_by_group[0]"/>
                                                    <span>&amp;nbsp;<span>on</span>
                                                        <t t-esc="amount_by_group[4]"/>
                                                    </span>
                                                </td>
                                                <td class="text-right o_price_total">
                                                    <span t-esc="amount_by_group[3]"/>
                                                </td>
                                            </t>
                                        </tr>
                                    </t>
                                    <tr class="border-black o_total">
                                        <td><strong>Total</strong></td>
                                        <td class="text-right">
                                            <span t-field="o.amount_total"/>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                        <div>
                            <table>
                                <tr>
                                    <td>
                                       <span t-field="o.user_id.name"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td>

<img t-if="o.user_id.user_signature" t-att-src="image_data_uri(o.user_id.user_signature)" style="max-height: 70px;" alt="Logo"/>

                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
            </xpath>


Thank you,

아바타
취소
작성자

in which template

<template id="inherit_report_invoice_document" inherit_id="account.report_invoice_document">

<!-- Insert your code ->

</template>

베스트 답변

Hi,

I think you can add custom header or footer to achieve this. Because header/footer added from external_layout and it will display in all pages. Also one more idea to think, you can choose different report template in odoo. there is one template with background image. So we can check how it comes to all pages and this will give your answer

I hope this will helpful to you.

Thanks

아바타
취소
베스트 답변

Try to give image path like that.

<img t-att-src="'/module_name/static/src/img/image_name.png'" />


아바타
취소
작성자

the path is correct in my example and gives me the right image

관련 게시물 답글 화면 활동
1
8월 23
5383
4
7월 19
8244
0
12월 18
3631
9
2월 17
5907
1
4월 25
1236