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

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 22
2396
7
thg 4 23
28407
2
thg 10 20
3741
2
thg 9 20
8946
1
thg 7 24
6474