Skip to Content
Menu
This question has been flagged

Hi Odoo Users,

For one of the new reports, a Rough Order of Magnitude (ROM), I need to change the tables sideways, so rotate them 90 degrees. A small example is given above. Currently, the 'normal' table in Odoo Reports like report_saleorder_document are vertical, with a continuous line being added once a product is added. I want the exact same, just to the side. The new report is already in landscape and it will never be more than 5 products, thus it will easily fit.

The best would be an upgraded version of the already existing code within the report_saleorder_document as that is already taken valuable data from the order, I want to continue from that information.

Could anyone help me with the necessary code? You would help me so much! Thank you advance for your help.



Line Nr.Item Ref.DescriptionQuantity
1BM-001BETA Machine1,00
2BM-002ALPHA Machine1,00

to

Item Nr.12
Item Ref.BM-001BM-002
DescriptionBETA MachineALPHA Machine
Quantity1,001,00

Kind regards,

Marco


Avatar
Discard
Author

<table class="table table-sm o_main_table">
<thead style="color: rgb(277,277,277);background-color: rgb(0, 0, 0)">
<tr>

<th name="th_line" class="text-left">Line nr.</th>
<th name="th_item_number" class="text-left">Item nr.</th>
<t t-set="line_no" t-value="0"/>
<th name="th_description" class="text-left o_bold">Description</th>
<th name="th_quantity" class="text-right">Quantity</th>
<th name="th_unit" class="text-left">Unit</th>

<th name="th_priceunit" class="text-right">Unit Price</th>
<th name="th_discount" t-if="display_discount" class="text-right" groups="product.group_discount_per_so_line">
<span>Disc.%</span>
</th>
<th name="th_taxes" class="text-right">Taxes</th>
<th name="th_subtotal" class="text-right">
<t groups="account.group_show_line_subtotals_tax_excluded">Amount</t>
<t groups="account.group_show_line_subtotals_tax_included">Total Price</t>
</th>
</tr>
</thead>
<tbody class="sale_tbody">

<t t-set="current_subtotal" t-value="0"/>

<t t-foreach="doc.order_line" t-as="line">

<t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
<t t-set="current_subtotal" t-value="current_subtotal + line.price_total" groups="account.group_show_line_subtotals_tax_included"/>

<tr t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''">
<t t-if="not line.display_type">

<t t-set="line_no" t-value="line_no + 1"/>
<td name="td_name"><span t-esc="line_no"/></td>
<td name="td_item_number"><span t-esc="line.product_id.default_code"/></td>
<td name="td_name"><span t-field="line.product_id.name"/>
</td>
<td name="td_quantity" class="text-right">
<span t-field="line.product_uom_qty"/>
</td>
<td name="td_uom" class="text-right">
<span t-field="line.product_uom" groups="uom.group_uom"/>
</td>

<td name="td_priceunit" class="text-right">
<span t-field="line.price_unit" t-options-widget="&quot;monetary&quot;"/>
</td>
<td t-if="display_discount" class="text-right" groups="product.group_discount_per_so_line">
<span t-field="line.discount" t-options-widget="&quot;integer&quot;"/>
</td>
<td name="td_taxes" class="text-right">
<span t-esc="', '.join(map(lambda x: (x.description or x.name), line.tax_id))">
<p></p>
</span>
</td>
<td name="td_subtotal" class="text-right o_price_total">
<span t-field="line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
<span t-field="line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
</td>
</t>
<t t-if="line.display_type == 'line_section'">
<td name="td_section_line" colspan="99">
<span t-field="line.name"/>
</td>
<t t-set="current_section" t-value="line"/>
<t t-set="current_subtotal" t-value="0"/>
</t>
<t t-if="line.display_type == 'line_note'">
<td name="td_note_line" colspan="99">
<span t-field="line.name"/>
</td>
</t>
</tr>

<t t-if="current_section and (line_last or doc.order_line[line_index+1].display_type == 'line_section')">
<tr class="is-subtotal text-right">
<td name="td_section_subtotal" colspan="99">
<strong class="mr16">Subtotal</strong>
<span t-esc="current_subtotal" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: doc.pricelist_id.currency_id}"/>
</td>
</tr>
</t>
</t>
</tbody>
</table>

Related Posts Replies Views Activity
2
Jan 23
10531
0
Jan 22
20
0
Jun 21
1682
0
May 21
1120
0
Jul 19
3359