Let say I have this table:
<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>
This table generates and prints invoice lines normally, but I need to group them in "groups" if they are assigned to that so-called "group".
What I mean is that if order line is assigned "Allotment Partner" (There is such field in Sales Orders, which I will add in invoice too), then they are added to that group. To understand it better lets take a look in this example:
Now with code written above, invoice would be printed something like this:
product1 discount1 quantity1 priceu1 taxes1 prices1
product2 discount2 quantity2 priceu2 taxes2 prices2
product3 discount3 quantity3 priceu3 taxes3 prices3
Now if those lines would be assigned that 'Allotment Partner', for example first and second line would be assigned allot_p1
and third line would be assigned allot_p2
(let say these are the names for Allotment Partners). So then it should print like this:
allot_p1
product1 discount1 quantity1 priceu1 taxes1 prices1
product2 discount2 quantity2 priceu2 taxes2 prices2
allot_p2
product3 discount3 quantity3 priceu3 taxes3 prices3
I imagine how to just show Allotment Partner for every line like this:
allot_p1 product1 discount1 quantity1 priceu1 taxes1 prices1
allot_p1 product2 discount2 quantity2 priceu2 taxes2 prices2
allot_p2 product3 discount3 quantity3 priceu3 taxes3 prices3
This one would be easy as I would just need to create additional td
. But such approach would not look that good, so I think it is possible to somehow automatically group lines and print it like in second example?