目前,当尝试打印表格记录多于单页所能包含的报表时,表格将被拆分为多个页面。拆分发生在到达底部边距的任何点,这可以预见地发生在表格行的中间,并将其内容拆分为两页(示例如下所示)。 我想修改此功能,以便当到达底部边距时,记录之间总是会发生中断。
最终打印使用以下报告模板。指示主报告表的代码部分被 xml 注释包围
<template id="outgoing_report_template">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<style>
.table-black-border {
border: 3px solid black;
border-collapse: collapse;
width: 100%;
}
.table-black-border th, .table-black-border td {
border: 1px solid black;
padding: 10px;
text-align: center;
font-size: 16px;
}
</style>
<img src="/custom_inventory/static/src/images/logo.png" alt="logo" width="150px" height="150px" style="float:left;margin-left:600px"/>
<table dir="rtl" style="text-align:center;font-size:20px;margin-left:auto;" width="30%">
<tr>
<td>
<span>الوزارة/الدائرة ________________________</span>
</td>
</tr>
<tr>
<td>
<span><![CDATA[ ]]></span>
</td>
</tr>
<tr>
<td>
<span><![CDATA[ ]]></span>
</td>
</tr>
<tr>
<td>
<pre style="border:none;">رقم ل</pre>
</td>
</tr>
</table>
<!-- Main report content -->
<table dir="rtl" style="text-align:center;" width="100%">
<tr>
<th colspan="4" style="font-size:48px;">
<span><u>مستند الاخراجات</u></span>
</th>
</tr>
<tr>
<td>
<span><![CDATA[ ]]></span>
</td>
</tr>
<tr style="font-size:16px;">
<td>
<span>صرف الى _______________________</span>
</td>
<td>
<span>من قبل ________________________</span>
</td>
<td>
<span>للسيد ________________________</span>
</td>
<td>
<span>التاريخ ________________________</span>
</td>
</tr>
<tr>
<td><span><![CDATA[ ]]></span></td>
</tr>
<tr style="font-size:16px;">
<td><span>بموجب طلب اللوازم رقم ________________________</span></td>
<td><span>تاريخ ________________________</span></td>
<td><span>موقع من ________________________</span></td>
<td><span>توقيع مأمور المستودع ________________________</span></td>
</tr>
</table>
<br/><br/>
<!--main report table start-->
<table class="table-black-border" style="float:right;" dir="RTL" width="100%">
<thead>
<tr>
<th rowspan="2" width="15%"><span>رقم التسجيل</span></th>
<th rowspan="2"><span>نوع اللوازم و وصفها</span></th>
<th rowspan="2"><span>الوحدة</span></th>
<th rowspan="2"><span>الكمية</span></th>
<th colspan="2"><span>سعر الوحدة</span></th>
<th colspan="2"><span>سعر الاجمالي</span></th>
<th rowspan="2"><span>الرصيد</span></th>
<th rowspan="2"><span>خانة التخزين</span></th>
<th rowspan="2"><span>الكمية المصروفة كتابة</span></th>
</tr>
<tr>
<th><span>فلس</span></th>
<th><span>دينار</span></th>
<th><span>فلس</span></th>
<th><span>دينار</span></th>
</tr>
</thead>
<tr t-foreach="docs.move_ids_without_package" t-as="move_line">
<td><span t-field="move_line.reference"/></td>
<td><span t-field="move_line.product_id"/></td>
<td><span t-field="move_line.product_uom"/></td>
<td><span t-esc="('%d' %(move_line.product_uom_qty))"/></td>
<td>
<div t-if="docs.origin">
<span t-esc="('%d' %(docs.get_report_price_unit(docs.origin, move_line.product_id.name) % 1 * 1000))"/>
</div>
<div t-if="not docs.origin">
<span t-esc="('%d' %(move_line.product_id.product_tmpl_id.list_price % 1 * 1000))"/>
</div>
</td>
<td>
<div t-if="docs.origin">
<span t-esc="('%d' %(docs.get_report_price_unit(docs.origin, move_line.product_id.name)))"/>
</div>
<div t-if="not docs.origin">
<span t-esc="('%d' %(move_line.product_id.product_tmpl_id.list_price))"/>
</div>
</td>
<td>
<div t-if="docs.origin">
<span t-esc="('%d' %(docs.get_report_price_subtotal(docs.origin, move_line.product_id.name) % 1 * 1000))"/>
</div>
<div t-if="not docs.origin">
<span t-esc="('%d' %(move_line.product_id.product_tmpl_id.list_price * move_line.product_uom_qty % 1 * 1000))"/>
</div>
</td>
<td>
<div t-if="docs.origin">
<span t-esc="('%d' %(docs.get_report_price_subtotal(docs.origin, move_line.product_id.name)))"/>
</div>
<div t-if="not docs.origin">
<span t-esc="('%d' %(move_line.product_id.product_tmpl_id.list_price * move_line.product_uom_qty))"/>
</div>
</td>
<td><span t-field="move_line.location_id.name"/></td>
<td><span t-field="move_line.location_dest_id.name"/></td>
<td><span t-esc="docs.number2words(move_line.quantity_done)"/></td>
</tr>
</table>
<!--main report table end-->
<br/><span><![CDATA[ ]]></span><br/>
<table dir="rtl" style="font-size:20px;text-align:center;" width="100%">
<tr>
<td>تاريخ ________________________</td>
<td>الوظيفة ________________________</td>
<td>إسم المستلم ________________________</td>
</tr>
<tr>
<td><span><![CDATA[ ]]></span></td>
</tr>
<tr>
<td>نسخة المحاسب ________________________</td>
<td></td>
<td>توقيع المستلم ________________________</td>
</tr>
<tr>
<td><span><![CDATA[ ]]></span></td>
</tr>
<tr>
<td>قرار رقم ________________________</td>
<td></td>
<td>تاريخ ________________________</td>
</tr>
</table>
</div>
</t>
</t>
</template>
</odoo>
您可以循环记录,指定一页应包含多少行然后使用
<p style="page-break-before:always;"> </p>
当计数的行数达到您指定的最大行数时。