Skip to Content
Menu
This question has been flagged
1 Reply
1462 Views

Hello everyone,

I have a problem with t-foreach, it give me an error in the module.

This is the code:


odoo

    data

        template id="report_custom_template_body"

            t t-call="web.external_layout"

                div class="page"


                    h1 b FACTURA b h1 


                    div

                        p Número:  t t-esc="o.payment_reference" br

                        Fecha: t t-esc="o.invoice_date" br

                        Forma de pago: t t-esc="" p

                    div


                    div

                        h3 b CLIENTE b h3

                        t t-esc="o.partner_id.name" br

                        t t-esc="o.partner_id.vat" br                        

                    div 


                    div

                        t t-foreach="o.product_id" t-as="p"  

                         

   p t t-esc="p_value" p

                        t

                    div

                div

            t

        template


        template id="report_custom_template"

            t t-call="web.html_container"

                t t-foreach="docs" t-as="o"

                    t t-call="custom.report_custom_template_body"

                t

            t

        template


    data

odoo

Avatar
Discard
Best Answer

Hi,

You can try this code

<template id="report_custom_template_body">
    <t t-call="web.external_layout">
        <div class="page">
            <h1><b>INVOICE</b></h1>
            <div>
                <p>Número: <t t-esc="o.payment_reference" /><br/>
                    Fecha: <t t-esc="o.invoice_date" /><br/>
                    Payment form: <t t-esc="o.payment_form" /></p>
            </div>
            <div>
                <h3><b>CUSTOMER</b></h3>
<t t-esc="o.partner_id.name" /><br/>
                <t t-esc="o.partner_id.vat" /><br/>
            </div>
            <div>
                <h3><b>PRODUCTS</b></h3>
                <t t-foreach="o.invoice_line_ids" t-as="line">
<p><t t-esc="line.product_id.name" /></p>
                </t>
            </div>
        </div>
    </t>
</template>


Hope it helps

Avatar
Discard
Related Posts Replies Views Activity
1
Feb 22
2105
7
Apr 23
27817
2
Oct 20
3476
2
Sep 20
8628
1
Jul 24
5985