[FIX] l10n_br_sales: show price_total on lines

This module was introduced in saas-16.4. In that version the sale
order report and portal template displayed both price_subtotal and
price_total for each sale order
line. 655d375af8 removed price_total.

Because this module removes price_subtotal we end up with no line
total at all on the default Brazilian quotation PDF and portal
view (just 3 columns: description, quantity and unit price).

Loosely inspired by l10n_cl [1], this commit changes our approach to
turn the two places where we use price_subtotal into price_total. The
aforementioned commit also changed the heading of this column from
"Subtotal" to a more generic "Amount", so there's no inconsistency
there. Although this is a bit of a mess, I can't think of a better
solution.

[1] https://github.com/odoo/odoo/blob/655d375af83dd49bbbd5f5818e319c3b0e9778c1/addons/l10n_cl/views/report_invoice.xml#L173-L175

closes odoo/odoo#159794

Related: odoo/enterprise#59703
Signed-off-by: Josse Colpaert <jco@odoo.com>
This commit is contained in:
Joren Van Onder
2024-04-09 23:14:46 +00:00
parent 66d2e285d6
commit bea603f865
2 changed files with 12 additions and 10 deletions
@@ -13,12 +13,14 @@
<template id="report_saleorder_document_brazil" inherit_id="sale.report_saleorder_document" primary="True">
<th name="th_taxes" position="replace"/>
<td name="td_taxes" position="replace"/>
<th name="th_subtotal" position="replace"/>
<td name="td_subtotal" position="replace"/>
<t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" position="attributes">
<attribute name="t-value">current_subtotal + line.price_total</attribute>
</t>
<span t-field="line.price_subtotal" position="attributes">
<attribute name="t-field">line.price_total</attribute>
</span>
<xpath expr="//t[@t-call='sale.document_tax_totals']" position="replace">
<t t-call="l10n_br_sales.document_tax_totals_brazil"/>
</xpath>
<!-- hide subsection subtotals, because they don't include tax -->
<td name="td_section_subtotal" position="replace"/>
</template>
</odoo>
@@ -5,17 +5,17 @@
<th id="taxes_header" position="replace"/>
<!-- hide the taxes td -->
<td id="taxes" position="replace"/>
<!-- hide the "Amount" th -->
<th id="subtotal_header" position="replace"/>
<!-- hide the "Amount" td -->
<td id='subtotal' position="replace"/>
<t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" position="attributes">
<attribute name="t-value">current_subtotal + line.price_total</attribute>
</t>
<span t-field="line.price_subtotal" position="attributes">
<attribute name="t-field">line.price_total</attribute>
</span>
<xpath expr="//t[@t-call='sale.sale_order_portal_content_totals_table']" position="replace">
<table class="table table-sm">
<t t-set="tax_totals" t-value="sale_order.tax_totals"/>
<t t-call="l10n_br_sales.document_tax_totals_brazil"/>
</table>
</xpath>
<!-- hide subsection subtotals, because they don't include tax -->
<xpath expr="//span[@t-out='current_subtotal']/.." position="replace"/>
</template>
</odoo>