我在Qweb中有两个长表问题。
1 /如果第一页上的所有表都没有位置,则Qweb在第二页上打印所有表。但是我想要表的第一部分在第一页上,第二部分在第二页上(请看img1和img2)。
2 /如果表格太长,我对所有页面的主题和正文都有疑问( thead和tbody从同一行开始,因此对于所有页面来说,第一个ligne都是不合法的,除了第一个(查看img3和img4)。
我添加了一条注释,以了解我在谈论哪个表(在表之前注释“此表”,在表之后注释“结束表”)。
谢谢
<odoo>
<data>
<record id="facture_cadre_format" model="report.paperformat">
<field name="name">European A4</field>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">80</field>
<field name="margin_bottom">23</field>
<field name="margin_left">7</field>
<field name="margin_right">7</field>
<field name="header_line" eval="False" />
<field name="header_spacing">70</field>
<field name="dpi">90</field>
</record>
<report id="new_factures"
string="Facture (new)"
model="account.invoice"
report_type="qweb-pdf"
name="livraison_report.new_facture"
paperformat="facture_cadre_format"
/>
<template id="new_facture">
<t t-call="report.html_container">
<t t-call="facture_layout.facture_layout">
<div class="page">
<!-- Report page content -->
<style>
tbody {
font-size: 10px;
}
.police {
font-size: 10px;
}
.tableau {
page-break-inside: avoid;
}
</style>
<t t-foreach="docs" t-as="o">
<h2>
<span t-if="o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')">Facture</span>
<span t-if="o.type == 'out_invoice' and o.state == 'proforma2'">PRO-FORMA</span>
<span t-if="o.type == 'out_invoice' and o.state == 'draft'">Draft Invoice</span>
<span t-if="o.type == 'out_invoice' and o.state == 'cancel'">Cancelled Invoice</span>
<span t-if="o.type == 'out_refund'">Refund</span>
<span t-if="o.type == 'in_refund'">Vendor Refund</span>
<span t-if="o.type == 'in_invoice'">Vendor Bill</span>
<span t-field="o.number"/>
</h2>
<div class="row mt32 mb32">
<div class="col-xs-2" t-if="o.name">
<strong>Description:</strong>
<p t-field="o.name"/>
</div>
<div class="col-xs-2" t-if="o.date_invoice">
<strong>Date de la facture:</strong>
<p t-field="o.date_invoice"/>
</div>
<div class="col-xs-2" t-if="o.date_due and o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')">
<strong>Date d'échéance:</strong>
<p t-field="o.date_due"/>
</div>
<div class="col-xs-2" t-if="o.origin">
<strong>Origine:</strong>
<p t-field="o.origin"/>
</div>
<div class="col-xs-2" t-if="o.partner_id.ref">
<strong>BL:</strong>
<span t-esc="', '.join(map(lambda x: (x.name), o.picking_id))"/>
</div>
<div name="reference" class="col-xs-2" t-if="o.reference">
<strong>Reference:</strong>
<p t-field="o.reference"/>
</div>
</div>
<!-- _______________________________________________________This Table__________________________________________________________________ -->
<table class="table table-condensed table-bordered ">
<thead>
<tr style="background-color:#A9E2F3;">
<th>Description</th>
<th class="hidden">Source Document</th>
<th class="text-right">P.U</th>
<th class="text-right">PPA</th>
<th class="text-right">PPH</th>
<th class="text-right">Qté</th>
<th class="text-center">UM</th>
<th class="text-center">Mnt Brut</th>
<th class="text-right">RM(%)</th>
<th class="text-right">Tax Excluded Price</th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.invoice_line_ids" t-as="l">
<td>
<span t-field="l.name"/>
<t t-if="(l.lot_formatted_note is not False)">
<div style="margin-left:25px;" t-field="l.lot_formatted_note" />
<br/>
</t>
</td>
<td class="hidden"><span t-field="l.origin"/></td>
<td class="text-right">
<span t-field="l.price_unit"/>
</td>
<td class="text-right">
<span t-field="l.ppa"/>
</td>
<td class="text-right">
<span t-field="l.prix_pharmacien"/>
</td>
<td class="text-right">
<span t-esc="'%.0f'%(l.quantity)"/>
</td>
<td class="text-center">
<span t-field="l.uom_id" groups="product.group_uom"/>
</td>
<td class="text-right">
<span t-field="l.price_subtotal_brut"/>
</td>
<td class="text-right">
<span t-field="l.discount"/>
</td>
<td class="text-right">
<span t-field="l.price_subtotal" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
</tbody>
</table>
<!-- _______________________________________________________End Table__________________________________________________________________ -->
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed table-bordered tableau">
<tr class="border-black" >
<td><strong>Montant BRUT</strong></td>
<td class="text-right">
<span t-field="o.amount_untaxed_brut" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
<tr class="border-black" >
<td><strong>Montant Remise</strong></td>
<td class="text-right">
<span t-field="o.amount_discount" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
<tr class="border-black">
<td><strong>Montant HT</strong></td>
<td class="text-right">
<span t-field="o.amount_untaxed" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
<t t-foreach="o._get_tax_amount_by_group()" t-as="amount_by_group">
<tr>
<td><span t-esc="amount_by_group[0] if len(o.tax_line_ids) > 1 else (o.tax_line_ids.tax_id.description or o.tax_line_ids.tax_id.name)"/></td>
<td class="text-right">
<span t-esc="amount_by_group[1]" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
</t>
<tr class="border-black">
<td><strong>Montant TTC</strong></td>
<td class="text-right">
<span t-field="o.amount_total" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
</table>
</div>
</div>
<p class="police">
<strong>ARRETEE LA PRESENTE FACTURE A LA SOMME DE:</strong>
<span t-field="o.amount_to_text"/>
</p>
<p t-if="o.comment">
<strong>Comment:</strong>
<span t-field="o.comment"/>
</p>
<p t-if="o.payment_term_id">
<span t-field="o.payment_term_id.note"/>
</p>
<p t-if="o.fiscal_position_id.note">
<strong>Fiscal Position Remark:</strong>
<span t-field="o.fiscal_position_id.note"/>
</p>
<table class="table table-condensed table-bordered tableau">
<thead>
<tr >
<th class="text-center"><strong>Commercial</strong></th>
<th class="text-center"><strong>Client</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<br/>
<br/>
</td>
<td>
<br/>
<br/>
</td>
</tr>
</tbody>
</table>
</t>
</div>
</t>
</t>
</template>
</data>
</odoo>
答案 0 :(得分:0)
使用<thead>
标签满足您的要求。
答案 1 :(得分:0)
您好,尝试更改此记录中某些字段的值,
<record id="facture_cadre_format" model="report.paperformat">
<field name="name">European A4</field>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">80</field>
<field name="margin_bottom">23</field>
<field name="margin_left">7</field>
<field name="margin_right">7</field>
<field name="header_line" eval="False" />
<field name="header_spacing">70</field>
<field name="dpi">90</field>
</record>
我也遇到了同样的问题,并在此处更改了一些值来纠正。我记不清哪个值。尝试更改page height
的值,如果不起作用,请尝试其他字段。