Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
3746 มุมมอง

How to create a report with number of pages equal to order lines

For example : i have 4 lines in sale order and i have to print that report 4 times

Any body help me to solve this issue.


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Example:

<template id="report_foo_document">
<t t-foreach="len(o.lines)" t-as="copy">
<t t-call="report.external_layout">
<div class="page">
.....
.....
</div>
</t>
</t>
</template>



อวตาร
ละทิ้ง
ผู้เขียน

Thanks for reply.

คำตอบที่ดีที่สุด

Hello,

To achieve this, you need to add an intermediate template to this template: code  

to be called from the translate_doc instead of sale.report_saleorder_lines. then in the second template we'll call sale.report_saleorder_lines template by the numbers of lines. So it'll be like:

<template id="report_saleorder">
<t t-call="report.html_container">
<t t-foreach="doc_ids" t-as="doc_id">
<t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'sale.report_saleorder_lines')"/>
</t>
</t>
</template>
<template id="report_saleorder_lines">
<t t-call="report.html_container">
<t t-foreach="o.order_line" t-as="l">
<t t-call="sale.report_saleorder_document"/>
</t>
</t>
</template>


This will end up with report copies equal to the lines in the SO.

I hope it'll helps

Regards,

อวตาร
ละทิ้ง

Also the answer of zbik works fine, and more simple than mine. I just didn't see it :)

ผู้เขียน

Thanks for reply.