Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][IMP] account_invoice_fixed_discount: avoid replace in xml #1710

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 13 additions & 16 deletions account_invoice_fixed_discount/reports/report_account_invoice.xml
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
<!-- Copyright 2017 ForgeFlow S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<template
id="report_invoice_document"
inherit_id="account.report_invoice_document"
priority="101"
>
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
<xpath expr="//t[@t-set='display_discount']" position="after">
<t
t-set="display_discount_fixed"
t-value="any([l.discount_fixed for l in o.invoice_line_ids])"
/>
</xpath>
<xpath expr="//th[@name='th_discount']/span" position="replace">
<xpath expr="//th[@name='th_discount']/span" position="attributes">
<attribute name="t-if">not display_discount_fixed</attribute>
</xpath>

<xpath expr="//th[@t-if='display_discount']/span" position="before">
<t t-if="display_discount_fixed">
<span>Discount Amount (%)</span>
</t>
<t t-else="">
<span>Disc. %</span>
</t>
</xpath>
<span t-field="line.discount" position="replace">

<span t-field="line.discount" position="before">
<t t-if="display_discount_fixed">
<span class="text-nowrap" t-field="line.discount_fixed" /> (or <span
<span class="text-nowrap" t-field="line.discount_fixed" /><span
class="text-nowrap"
t-field="line.discount"
/> %)
</t>
<t t-else="">
<span class="text-nowrap" t-field="line.discount" />
> (or</span>
</t>
</span>
<span t-field="line.discount" position="after">
<t t-if="display_discount_fixed"><span class="text-nowrap"> %)</span></t>
</span>
</template>
</odoo>