Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
5 Trả lời
9639 Lượt xem

I need a different footer on the scond pdf page.

I added this to the footer template


    <p class="test">test</p>

    <script>
        document.getElementsByClassName('test')[0].innerHTML="only on first page";
    </script>

        <div>
                <t t-if="count() == 1">
                    only on first page
                    </t>
            </div>

but this change the text test on all page.

The pdf file has two pages, but the python method count() only called ones.

Thanks

 

 

 

 

Ảnh đại diện
Huỷ bỏ

<template id="test_report"> <div class="header">Header for first page</div> <div class="page">Content for first page</div> <div class="footer">Footer for first page</div> <div class="header">Header for second page</div> <div class="page">Content for second page</div> <div class="footer">Footer for second page</div> </template>

Did you manage it?

Câu trả lời hay nhất

PDF report uses header,page and footer css class for header/footer display. The following code will generate a 2 page pdf, with different header and footer. You can refer to get_pdf method in addons/report/models/report.py

Header for first page
Content for first page
Header for second page
Content for second page
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Works great Binary System Limited :)

Ảnh đại diện
Huỷ bỏ