<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <template
        id="sale_order_portal_content"
        inherit_id="sale.sale_order_portal_content"
    >
        <xpath
            expr="//section[@id='details']//t[@t-set='display_discount']"
            position="after"
        >
            <t
                t-set="display_discount_fixed"
                t-value="True in [line.discount_fixed > 0 for line in sale_order.order_line]"
            />
        </xpath>
        <xpath
            expr="//section[@id='details']//table/thead//th[@t-if='display_discount']"
            position="before"
        >
            <th
                t-if="display_discount_fixed"
                t-attf-class="text-end {{ 'd-none d-sm-table-cell' if report_type == 'html' else '' }}"
            >
                <span>Disc. Fixed Amount</span>
            </th>
        </xpath>
        <xpath expr="//div[@t-field='line.price_unit']" position="attributes">
            <attribute
                name="t-if"
            >line.discount &gt;= 0 or line.fixed_discount &gt;= 0</attribute>
            <attribute
                name="t-att-style"
            >(line.discount or line.discount_fixed) and 'text-decoration: line-through' or None</attribute>
            <attribute
                name="t-att-class"
            >((line.discount or line.discount_fixed) and 'text-danger' or '') + ' text-right'</attribute>
        </xpath>
        <xpath expr="//div[@t-if='line.discount']/t" position="attributes">
            <attribute name="t-out">line.price_unit - line.discount_fixed</attribute>
        </xpath>
        <xpath expr="//td[@t-if='display_discount']" position="before">
            <td
                t-if="display_discount_fixed"
                t-attf-class="text-end {{ 'd-none d-sm-table-cell' if report_type == 'html' else '' }}"
            >
                <strong t-if="line.discount_fixed &gt; 0" class="text-info">
                    <t t-esc="line.discount_fixed" />
                </strong>
            </td>
        </xpath>
    </template>
</odoo>
