Partial Revert "[FIX] sale: subtotal computation and display"

This partially reverts commit e2e27b41ad.

The commit changes the DOM structure in order to pretty print both
amount (value without tax, B2B setting) and total price (value with tax,
B2C setting). Actually having both (B2B and B2C) is a client
misconfiguration and we do not support that, furthermore changing the DOM
structures can break inherited templates.

The said commit was also fine tunning 716ff76, the fine tune is
related the the removal of the dynamic colspan attribute. The section,
note and subtotal should take the entire width of the table, setting the
colspan to an abritary maximum ensures they fill the entire width.

closes odoo/odoo#32194

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
Julien Castiaux
2019-03-28 09:36:41 +00:00
parent 09fb2469b4
commit 3b5f33281d
3 changed files with 38 additions and 59 deletions
+12 -19
View File
@@ -59,18 +59,19 @@
<span>Disc.(%)</span>
</th>
<th t-attf-class="text-left {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"><span>Taxes</span></th>
<th class="text-right" groups="account.group_show_line_subtotals_tax_excluded">Amount</th>
<th class="text-right" groups="account.group_show_line_subtotals_tax_included">Total Price</th>
<th class="text-right">
<span groups="account.group_show_line_subtotals_tax_excluded">Amount</span>
<span groups="account.group_show_line_subtotals_tax_included">Total Price</span>
</th>
</tr>
</thead>
<tbody class="invoice_tbody">
<t t-set="current_subtotal_tax_excluded" t-value="0"/>
<t t-set="current_subtotal_tax_included" t-value="0"/>
<t t-set="current_subtotal" t-value="0"/>
<t t-foreach="o.invoice_line_ids" t-as="line">
<t t-set="current_subtotal_tax_excluded" t-value="current_subtotal_tax_excluded + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
<t t-set="current_subtotal_tax_included" t-value="current_subtotal_tax_included + line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
<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" name="account_invoice_line_accountable">
@@ -89,11 +90,9 @@
<td t-attf-class="text-left {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span t-esc="', '.join(map(lambda x: (x.description or x.name), line.invoice_line_tax_ids))"/>
</td>
<td class="text-right o_price_total" groups="account.group_show_line_subtotals_tax_excluded">
<span t-field="line.price_subtotal"/>
</td>
<td class="text-right o_price_total" groups="account.group_show_line_subtotals_tax_included">
<span t-field="line.price_total"/>
<td 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'">
@@ -101,8 +100,7 @@
<span t-field="line.name"/>
</td>
<t t-set="current_section" t-value="line"/>
<t t-set="current_subtotal_tax_excluded" t-value="0"/>
<t t-set="current_subtotal_tax_included" t-value="0"/>
<t t-set="current_subtotal" t-value="0"/>
</t>
<t t-if="line.display_type == 'line_note'">
<td colspan="99">
@@ -116,14 +114,9 @@
<td colspan="99">
<strong class="mr16">Subtotal</strong>
<span
groups="account.group_show_line_subtotals_tax_excluded"
t-esc="current_subtotal_tax_excluded"
t-esc="current_subtotal"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'
/>
<span groups="account.group_show_line_subtotals_tax_included"> | <span
t-esc="current_subtotal_tax_included"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'
/></span>
</td>
</tr>
</t>
+13 -20
View File
@@ -77,19 +77,20 @@
<span>Disc.(%)</span>
</th>
<th class="text-right">Taxes</th>
<th class="text-right" groups="account.group_show_line_subtotals_tax_excluded">Amount</th>
<th class="text-right" groups="account.group_show_line_subtotals_tax_included">Total Price</th>
<th 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_tax_excluded" t-value="0"/>
<t t-set="current_subtotal_tax_included" t-value="0"/>
<t t-set="current_subtotal" t-value="0"/>
<t t-foreach="doc.order_line" t-as="line">
<t t-set="current_subtotal_tax_excluded" t-value="current_subtotal_tax_excluded + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
<t t-set="current_subtotal_tax_included" t-value="current_subtotal_tax_included + line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
<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">
@@ -107,11 +108,9 @@
<td class="text-right">
<span t-esc="', '.join(map(lambda x: (x.description or x.name), line.tax_id))"/>
</td>
<td class="text-right o_price_total" groups="account.group_show_line_subtotals_tax_excluded">
<span t-field="line.price_subtotal"/>
</td>
<td class="text-right o_price_total" groups="account.group_show_line_subtotals_tax_included">
<span t-field="line.price_total"/>
<td 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'">
@@ -119,8 +118,7 @@
<span t-field="line.name"/>
</td>
<t t-set="current_section" t-value="line"/>
<t t-set="current_subtotal_tax_excluded" t-value="0"/>
<t t-set="current_subtotal_tax_included" t-value="0"/>
<t t-set="current_subtotal" t-value="0"/>
</t>
<t t-if="line.display_type == 'line_note'">
<td colspan="99">
@@ -131,17 +129,12 @@
<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 colspan="99" groups="account.group_show_line_subtotals_tax_excluded,account.group_show_line_subtotals_tax_included">
<td colspan="99">
<strong class="mr16">Subtotal</strong>
<span
groups="account.group_show_line_subtotals_tax_excluded"
t-esc="current_subtotal_tax_excluded"
t-esc="current_subtotal"
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'
/>
<span groups="account.group_show_line_subtotals_tax_included"> | <span
t-esc="current_subtotal_tax_included"
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'
/></span>
</td>
</tr>
</t>
+13 -20
View File
@@ -435,19 +435,20 @@
<span>Discount</span>
</th>
<th t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">Taxes</th>
<th class="text-right" groups="account.group_show_line_subtotals_tax_excluded">Amount</th>
<th class="text-right" groups="account.group_show_line_subtotals_tax_included">Total Price</th>
<th class="text-right" >
<span groups="account.group_show_line_subtotals_tax_excluded">Amount</span>
<span groups="account.group_show_line_subtotals_tax_included">Total Price</span>
</th>
</tr>
</thead>
<tbody class="sale_tbody">
<t t-set="current_subtotal_tax_excluded" t-value="0"/>
<t t-set="current_subtotal_tax_included" t-value="0"/>
<t t-set="current_subtotal" t-value="0"/>
<t t-foreach="sale_order.order_line" t-as="line">
<t t-set="current_subtotal_tax_excluded" t-value="current_subtotal_tax_excluded + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
<t t-set="current_subtotal_tax_included" t-value="current_subtotal_tax_included + line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
<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">
@@ -478,11 +479,9 @@
<td t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span t-esc="', '.join(map(lambda x: (x.description or x.name), line.tax_id))"/>
</td>
<td class="text-right o_price_total" groups="account.group_show_line_subtotals_tax_excluded">
<span t-field="line.price_subtotal"/>
</td>
<td class="text-right o_price_total" groups="account.group_show_line_subtotals_tax_included">
<span t-field="line.price_total"/>
<td class="text-right">
<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'">
@@ -490,8 +489,7 @@
<span t-field="line.name"/>
</td>
<t t-set="current_section" t-value="line"/>
<t t-set="current_subtotal_tax_excluded" t-value="0"/>
<t t-set="current_subtotal_tax_included" t-value="0"/>
<t t-set="current_subtotal" t-value="0"/>
</t>
<t t-if="line.display_type == 'line_note'">
<td colspan="99">
@@ -505,14 +503,9 @@
<td colspan="99">
<strong class="mr16">Subtotal</strong>
<span
groups="account.group_show_line_subtotals_tax_excluded"
t-esc="current_subtotal_tax_excluded"
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'
t-esc="current_subtotal"
t-options='{"widget": "monetary", "display_currency": sale_order.pricelist_id.currency_id}'
/>
<span groups="account.group_show_line_subtotals_tax_included"> | <span
t-esc="current_subtotal_tax_included"
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'
/></span>
</td>
</tr>
</t>