gn_odoo/gn_discount/views/sale_portal.xml
2023-12-06 10:56:57 +01:00

76 lines
2.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="gn_discount.portal_order_view_template" inherit_id="sale.sale_order_portal_content">
<xpath expr="//td[.//span[@class='oe_order_line_price_subtotal']]" position="replace">
<td class="text-right">
<span class="oe_order_line_price_subtotal" t-field="line.price_subtotal_before_discount"/>
</td>
</xpath>
<xpath expr="//td[div[@t-field='line.price_unit']]" position="replace">
<td t-attf-class="text-right {{ 'd-none d-sm-table-cell' if report_type == 'html' else '' }}">
<div t-field="line.price_unit" t-attf-class="text-right"/>
</td>
</xpath>
<xpath expr="//t[@t-set='display_discount']" position="replace">
<t t-set="display_discount" t-value="false"/>
</xpath>
<!--<xpath expr="//strong[@class='text-info']" position="replace">
<strong t-if="line.discount &gt; 0" class="text-info">
<t t-esc="'{:.2f}'.format(line.discount)"/>%
</strong>
</xpath>-->
</template>
<template id="gn_discount.portal_order_view_totals" inherit_id="sale.sale_order_portal_content_totals_table">
<xpath expr="//tr[@class='border-black'][1]" position="replace">
<t t-if="sale_order.amount_discount &gt; 0">
<tr class="border-black">
<td><strong>Subtotal</strong></td>
<td class="text-right">
<div>
<span
t-att-style="'text-decoration: line-through' or None"
t-att-class="'text-danger' or ''"
data-id="total_before_discount"
t-field="sale_order.amount_undiscounted"
t-options='{"widget": "monetary","display_currency": sale_order.pricelist_id.currency_id}'
/>
</div>
</td>
</tr>
<tr>
<td>Discount</td>
<td class="text-right">
<div>
<div t-if="sale_order.amount_discount">
<span>-</span><t t-esc="sale_order.amount_discount" t-options='{"widget": "monetary","display_currency": sale_order.pricelist_id.currency_id}'/>
</div>
</div>
</td>
</tr>
<tr>
<td><strong>Subtotal with discount</strong></td>
<td class="text-right">
<div>
<div t-if="sale_order.amount_discount">
<t t-esc="sale_order.amount_untaxed" t-options='{"widget": "monetary","display_currency": sale_order.pricelist_id.currency_id}'/>
</div>
</div>
</td>
</tr>
</t>
<t-else>
<tr class="border-black">
<td><strong>Subtotal</strong></td>
<td class="text-right">
<div>
<span t-field="sale_order.amount_untaxed"/>
</div>
</td>
</tr>
</t-else>
</xpath>
</template>
</odoo>