このテーブルがあるとしましょう:
<para style="terp_default_2">[[ repeatIn(o.invoice_line,'l') ]]</para>
<blockTable colWidths="180.0,65.0,75.0,70.0,60.0,80.0" style="Table8">
<tr>
<td>
<para style="terp_default_9">[[ format(l.name) ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ formatLang(l.discount, dp='Account', digits=2) ]] </para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(l.quantity, digits=2)]] [[ (l.uos_id and l.uos_id.name) or '' ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ formatLang(l.price_unit, digits=2) ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ ', '.join([ lt.name or '' for lt in l.invoice_line_tax_id ]) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(l.price_subtotal, dp='Account', digits=2, currency_obj=o.currency_id) ]]</para>
</td>
</tr>
</blockTable>
このテーブルは通常どおり請求書明細を生成して印刷しますが、それらがいわゆる「グループ」に割り当てられている場合は、それらを「グループ」にグループ化する必要があります。
つまり、注文明細に「割り当てパートナー」が割り当てられている場合 (販売注文にそのようなフィールドがあり、請求書にも追加します)、そのグループに追加されます。それをよりよく理解するために、次の例を見てみましょう。
上記のコードを使用すると、請求書は次のように出力されます。
product1 discount1 quantity1 priceu1 taxes1 prices1
product2 discount2 quantity2 priceu2 taxes2 prices2
product3 discount3 quantity3 priceu3 taxes3 prices3
これらの明細に「割り当てパートナー」が割り当てられる場合、たとえば、1 番目と 2 番目の明細が割り当てられallot_p1
、3 番目の明細が割り当てられますallot_p2
(これらが割り当てパートナーの名前であるとします)。したがって、次のように出力されます。
allot_p1
product1 discount1 quantity1 priceu1 taxes1 prices1
product2 discount2 quantity2 priceu2 taxes2 prices2
allot_p2
product3 discount3 quantity3 priceu3 taxes3 prices3
次のように、すべての行の割り当てパートナーを表示する方法を想像します。
allot_p1 product1 discount1 quantity1 priceu1 taxes1 prices1
allot_p1 product2 discount2 quantity2 priceu2 taxes2 prices2
allot_p2 product3 discount3 quantity3 priceu3 taxes3 prices3
追加の を作成するだけなので、これは簡単td
です。しかし、そのようなアプローチは見栄えがよくないので、2番目の例のように自動的に行をグループ化して印刷することは可能だと思いますか?