Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
1543 Vistas

I want to make the footer at the bottom of the page, but always below the table...



<odoo>

    <template id="report_penyerahan_barang_template">

        <t t-call="web.html_container">

            <style type="text/css">

                .page {

                    position: relative;

                    width: 100%;

                    page-break-before: auto;

                }


                /* Memaksa halaman kedua dan seterusnya untuk dimulai dari halaman baru */

                .page:nth-of-type(n+2) {

                    page-break-before: always;

                }


                .header {

                    width: 100%;

                }


                .header td p {

                    margin: 0;

                }


                .footer {

                    position: fixed;

                    bottom: 0;

                }


                h2 {

                    margin: 0;

                }


                .table {

                    border-collapse: collapse;

                    width: 100%;

                    border: solid;

                    border-width: 1px;

                }


                .table th, .table td {

                    padding: 0px;

                    border: solid;

                    border-width: 1px;

                }


                .table-wrapper {

                    max-height: calc(9 * 3px);

                    border: 1px solid #ccc;

                }


                .table-collapse td {

                    font-size: 14px;

                }


                .td p {

                    margin: 0;

                }

            </style>


            <t t-foreach="docs" t-as="picking">

                <t t-set="items_per_page" t-value="8"/>

                <t t-set="total_items" t-value="len(picking.move_lines)"/>

                <t t-set="page_count" t-value="(total_items + items_per_page - 1) // items_per_page"/>

                <t t-set="move_lines" t-value="picking.move_line_ids.filtered(lambda l: l.qty_done > 0).sorted(lambda l: l.product_id.default_code or '')"/>

                <t t-set="total_moves" t-value="len(move_lines)"/>

                <t t-set="chunks" t-value="[]"/>

                <t t-set="page_idx" t-value="0"/>


                <t t-foreach="range(0, total_moves, items_per_page)" t-as="i">

                    <t t-set="chunks" t-value="chunks + [move_lines[i:i + items_per_page]]"/>

                </t>


                <t t-foreach="chunks" t-as="chunk">

                    <div class="page">

                        <br/>

                        <br/>

                        <br/>

                        <header>

                            <h2 style="text-align: center;">SURAT PENYERAHAN BARANG</h2>

                            <table style="margin-top: 3px;" class="header">

                                <tr>

                                    <td style="font-size: 14px; width: 73%;">

                                        <p>

                                            <strong>Kepada Yth:</strong>

                                            <t t-esc="picking.sale_id.partner_invoice_id.name"/>

                                        </p>

                                        <p style="margin-bottom: 3px; min-height: 20px;">

                                            <t t-esc="picking.sale_id.partner_invoice_id.street"/>

                                        </p>

                                        <p>

                                            <strong>Diserahkan Kepada:</strong>

                                            <t t-esc="picking.partner_id.name"/>

                                        </p>

                                        <p style="margin-bottom: 2px; min-height: 20px;">

                                            <t t-esc="picking.partner_id.street"/>

                                        </p>

                                        <p>

                                            <strong>No. PO:</strong>

                                            <t t-esc="picking.sale_id.reference_po"/>

                                        </p>

                                    </td>

                                    <td style="font-size: 15px; width: 14%;">

                                        <p>No. SPB</p>

                                        <p>Tgl SPB</p>

                                        <p>Nama Ekspedisi</p>

                                        <p>No Kendaraan</p>

                                    </td>

                                    <td style="font-size: 16px; width: 1%;">

                                        <p>: </p>

                                        <p>: </p>

                                        <p>: </p>

                                        <p>: </p>

                                    </td>

                                    <td style="font-size: 15px; width: 12%;">

                                        <t t-set="page_idx" t-value="page_idx or 0"/>

                                        <p>Hal: <t t-esc="page_idx + 1"/> / <t t-esc="page_count"/></p>

                                        <p><t t-esc="picking.name"/></p>

                                        <p style="margin-bottom: 50%;"> <t t-esc="datetime.datetime.now().strftime('%d-%m-%Y')"/> </p>

                                    </td>

                                </tr>

                            </table>

                        </header>

                        <section>

                            <!-- Bungkus tabel dalam div untuk max-height -->

                            <div class="table-wrapper">

                                <table class="table">

                                    <thead>

                                        <tr>

                                            <th>No</th>

                                            <th>Kuantitas</th>

                                            <th>Kode Barang</th>

                                            <th>Nama Barang</th>

                                            <th>No. SO</th>

                                        </tr>

                                    </thead>

                                    <tbody>

                                        <t t-set="counter" t-value="1 + page_idx * items_per_page"/>

                                        <t t-foreach="chunk" t-as="move_line">

                                            <tr>

                                                <td style="text-align: center; width: 4%; font-size: 16px;">

                                                    <t t-esc="counter"/>

                                                    <t t-set="counter" t-value="counter + 1"/>

                                                </td>

                                                <td style="text-align: center; font-size: 12px;">

                                                    <table style="width: 100%; border: none;">

                                                        <tr>

                                                            <td style="text-align: left; border: none;">

                                                                <t t-esc="int(move_line.qty_done)"/> EA

                                                            </td>

                                                            <td style="text-align: right; border: none;">

                                                                <t t-esc="move_line.product_id.default_code.split('-', 2)[-1]"/>

                                                            </td>

                                                        </tr>

                                                    </table>

                                                </td>

                                                <td style="text-align: left; width: 20%; font-size: 16px;">

                                                    <t t-if="move_line.product_id.default_code">

                                                        <t t-esc="move_line.product_id.default_code"/>

                                                    </t>

                                                    <t t-else="">N.A</t>

                                                </td>

                                                <td style="width: 43%; font-size: 16px;">

                                                    <t t-esc="move_line.product_id.name"/>

                                                </td>

                                                <td style="text-align: center; width: 16%; font-size: 16px;">

                                                    <t t-esc="picking.sale_id.name"/>

                                                </td>

                                            </tr>

                                        </t>

                                    </tbody>

                                </table>

                            </div>

                        </section>

                        <footer>

                            <table style="width: 100%;">

                                <tr>

                                    <td class="td" style="width: 40%; text-align: left;font-size: 14px;">

                                        <p>Diterima Oleh :</p>

                                        <p style="margin-bottom: 100px;">(Pembeli)</p>

                                        <p>Nama</p>

                                        <p>Tgl.</p>

                                    </td>

                                    <td class="td" style="width: 35%; text-align: left; font-size: 14px;">

                                        <p>Diserahkan Oleh :</p>

                                        <p style="margin-bottom: 100px; margin-top: 0;">(Kepala Gudang)</p>

                                        <p>Nama</p>

                                        <p style="margin-top: 0;">Tgl.</p>

                                    </td>

                                    <td class="td" style="width: 35%; text-align: left; font-size: 14px;">

                                        <p>Dibuat Oleh :</p>

                                        <p style="margin-bottom: 100px; margin-top: 0;">(Adm. Penjualan)</p>

                                        <p>Nama</p>

                                        <p style="margin-top: 0;">Tgl.</p>

                                    </td>

                                </tr>

                            </table>

                        </footer>

                        <t t-set="page_idx" t-value="page_idx + 1"/>

                    </div>

                </t>

            </t>

        </t>

    </template>

</odoo>



Avatar
Descartar
Mejor respuesta

Hi,

I hope you are doing well,

<div t-attf-class="footer o_standard_footer o_company_#{company.id}_layout">
<!-- <div class="text-center" style="background-color: #15003d;font-size:13px;padding-botton:0px;"> -->
<div class="text-center">
<ul class="list-inline mb4">
<div t-field="company.report_footer"/>
<table class="table table-sm table-striped" style="zoom:75%;">
<tbody>
<tr>
<td colspan="2">
<center>Your content</center>
</td>
</tr>
<tr>
<td colspan="2">
<center>This is a Computer Generated Invoice
</center>
</td>
</tr>
</tbody>
</table>
</ul>
<div t-if="report_type == 'pdf'" class="text-muted">
<strong>TAX INVOICE (Page
<span class="page"/>)
</strong>
</div>
</div>
</div>

Can you try above code This is Odoo by deafult use.

You can user this class in your footer tag.

footer at the bottom of the page and always below after body content.

Thanks.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
sept 24
1066
1
jun 24
1415
1
may 24
1636
3
may 24
1820
1
may 25
1212