Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2872 Visualizzazioni

Hi

I'm trying to make my own report that uses a custom paper format and custom template. In this template there should be a header, the addresses of both the supplier and my company, the order lines and then a footer with an image. Only the header and order lines appear on the final document, and I can't seem to figure out what's wrong with my code.

All information for both the partner and my company are filled in so they should appear, but they don't. The footer also doesnt't appear. Here is my code: 

<odoo>
    <record id="paperformat_A4_no_header" model="report.paperformat">
        <field name="name">A4 Zonder header</field>
        <field name="format">custom</field>
        <field name="page_height">297</field>
        <field name="page_width">210</field>
        <field name="orientation">Portrait</field>
        <field name="margin_top">5</field>
        <field name="margin_bottom">5</field>
        <field name="margin_left">3</field>
        <field name="margin_right">3</field>
        <field name="header_line" eval="False"/>
        <field name="header_spacing">10</field>
        <field name="dpi">90</field>
    </record>

   <report id="test_report_purchase" model="purchase.order" string="test custom report order" report_type="qweb-pdf"
            name="picture_module.test_custom_report_poq" menu="True" paperformat="picture_module.paperformat_A4_no_header"/>

    <template id="custom_footer_report">
            <div class="footer">
                <div class="text-center">
                    <ul class="list-inline">
                        <li><img src="/picture_module/static/src/img/Excel_voet_NL.jpg"/></li>
                    </ul>
                </div>
            </div>
          <!--
                    <footer style="position: absolute; height: 51mm; bottom: 60mm; width: 230mm;">
                        <div>
                            <img src="/picture_module/static/src/img/Excel_voet_NL.jpg" style="height: 50mm; width: 230mm; margin-bottom: -4mm"/>

                        </div>
                    </footer>-->
    </template>

    <template id="test_custom_report_poq">
        <t t-name="purchase.test_custom_report_poq">
            <t t-call="web.basic_layout">
                <t t-foreach="docs" t-as="o" t-lang="o.partner_id.lang">
                <html style="margin-left: 15mm; margin-right: 5mm; page-break-after: always; page-break-inside: avoid;">
                    <header>
                        <img src="/picture_module/static/src/img/Excel_hoofd_NL.jpg" style="height: 32mm; width: 200mm; margin-top: -15mm"/>
                    </header>

                    <div class="page">
                        <t t-set="address">
                            <div t-field="o.partner_id" t-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;, &quot;phone&quot;], &quot;no_marker&quot;: True, &quot;phone_icons&quot;: True}"/>
                            <p t-if="o.partner_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'Tax ID'"/>: <span t-field="o.partner_id.vat"/></p>
                        </t>
                        <t t-if="o.dest_address_id">
                            <t t-set="information_block">
                                <strong>Shipping address:</strong>
                                <div t-field="o.dest_address_id" t-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;, &quot;phone&quot;], &quot;no_marker&quot;: True, &quot;phone_icons&quot;: True}" name="purchase_shipping_address"/>
                            </t>
                        </t>

                        <div class="oe_structure"/>

                        <h2>Request for Quotation <span t-field="o.name"/></h2>
                        <table class="table table-sm">
                            <thead>
                                <tr>
                                    <th><strong>Description</strong></th>
                                    <th class="text-center"><strong>Expected Date</strong></th>
                                    <th class="text-right"><strong>Qty</strong></th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr t-foreach="o.order_line" t-as="order_line">
                                    <td>
                                        <span t-field="order_line.name"/>
                                    </td>
                                    <td class="text-center">
                                        <span t-field="order_line.date_planned"/>
                                    </td>
                                    <td class="text-right">
                                        <span t-field="order_line.product_qty"/>
                                        <span t-field="order_line.product_uom" groups="uom.group_uom"/>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <t t-call="picture_module.custom_footer_report"/>
                    </div>
                    <!--<t t-call="picture_module.custom_footer_report"/>-->
                </html>
                </t>
            </t>
        </t>
    </template>
</odoo>

Avatar
Abbandona

Look into Odoo Customization Tips: https://www.scoop.it/t/learn-openerp

Post correlati Risposte Visualizzazioni Attività
3
mar 18
8108
8
dic 23
22240
2
nov 24
7937
1
mag 24
3240
0
lug 17
3665