[FIX] sale: show discount in portal

Before this commit, discount was never displayed in the portal.
So if you bought 1 iPad at 1800$ with 50% you see in your poral:

Product         Unit P.  Qty  Subtotal
[photo] Ipad    $1800    1.0      $900

Now, similarly to the report pdf, we show discount if at least
one line contains a discount.

This commit closes #11305
This commit is contained in:
Jeremy Kersten
2018-03-21 17:17:37 +01:00
parent 9543e24a8d
commit 0f1f5409ef
+11 -3
View File
@@ -221,13 +221,18 @@
<hr/>
<t t-set="display_discount" t-value="any([l.discount for l in order.order_line])"/>
<div class="row">
<div class="col-md-6">
<div t-att-class="'col-md-5' if display_discount else 'col-md-6'">
<strong>Product</strong>
</div>
<div class="hidden-sm hidden-xs col-md-2 text-right">
<strong>Unit Price</strong>
</div>
<div t-if="display_discount" class="hidden-sm hidden-xs col-md-1 text-right" >
<strong>Discount</strong>
</div>
<div class="hidden-sm hidden-xs col-md-2 text-right">
<strong>Quantity</strong>
</div>
@@ -240,12 +245,15 @@
<div class="visible-lg col-lg-1 text-center">
<span t-field="ol.product_image" t-options="{'widget': 'image', 'class': 'img-rounded', 'style':'width: 48px;height:48px'}" />
</div>
<div id='product_name' class="col-lg-4 col-sm-6 col-xs-3">
<div id='product_name' t-att-class="'col-lg-3 col-sm-5 col-xs-4' if display_discount else 'col-lg-4 col-sm-6 col-xs-3'">
<span t-esc="ol.product_id.name"/>
</div>
<div class="col-xs-3 text-right">
<div class="col-sm-3 hidden-xs text-right">
<span t-field="ol.price_unit" t-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/>
</div>
<div t-if="display_discount" class="col-sm-1 hidden-xs text-right" style='white-space: nowrap'>
<span t-field="ol.discount"/> %
</div>
<div class="col-xs-2 text-right">
<t t-if="ol._name == 'sale.order.line'">
<span t-esc="ol.product_uom_qty"/>