[FIX] account: currency issue in payement receipt print

Steps to reproduce:
	- install the "account" module (Invoicing app);
	- create an invoice;
	- make partial payments in other currencies,
	- print the payment receipt.

Issues:
	The amount and the currency do not match.
	In addition, it is difficult to see the conversion between the payment currency and the invoice currency.

Causes:
	The currency symbol of the line corresponds to the payment currency.
	The amount of the line corresponds to the amount converted into the base currency of the invoice.

Solutions:
	Add one column named "Amount In Currency" and add the amount in the currency of the payment.
	In the column "Amount", correct the symbol of the currency.

opw-2973067

closes odoo/odoo#101489

X-original-commit: b05d95a046fb7cfd438adce3d5f1e8b2f84953bf
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
This commit is contained in:
Thomas Lefebvre (thle)
2022-09-29 08:05:45 +02:00
parent ee6c6c1b9e
commit 9cb4cbc270
2 changed files with 25 additions and 4 deletions
+6
View File
@@ -817,6 +817,12 @@ msgstr ""
msgid "<span>Amount</span>"
msgstr ""
#. module: account
#: model_terms:ir.ui.view,arch_db:account.bill_preview
#: model_terms:ir.ui.view,arch_db:account.report_payment_receipt_document
msgid "<span>Amount In Currency</span>"
msgstr ""
#. module: account
#: model_terms:ir.ui.view,arch_db:account.bill_preview
#: model_terms:ir.ui.view,arch_db:account.report_invoice_document
@@ -33,18 +33,26 @@
</div>
</div>
</div>
<t t-set="partials" t-value="o.move_id._get_reconciled_invoices_partials()[0]"/>
<t t-set="invoices" t-value="{partial[2].move_id for partial in partials}"/>
<!-- Check if invoices include different currencies -->
<t t-foreach="invoices" t-as="inv">
<t t-if="any(inv.currency_id != par[2].currency_id for par in inv._get_reconciled_invoices_partials()[0])" t-set="otherCurrency" t-value="True"/>
</t>
<table class="table table-sm">
<thead>
<tr>
<th><span>Invoice Date</span></th>
<th><span>Invoice Number</span></th>
<th><span>Reference</span></th>
<!-- Add a column if there are different currencies -->
<th t-if="otherCurrency" class="text-end"><span>Amount In Currency</span></th>
<th class="text-end"><span>Amount</span></th>
</tr>
</thead>
<tbody>
<t t-set="partials" t-value="o.move_id._get_reconciled_invoices_partials()[0]"/>
<t t-set="invoices" t-value="{partial[2].move_id for partial in partials}"/>
<t t-foreach="invoices" t-as="inv">
<!-- MOVE -->
<t t-if="inv.move_type != 'entry'">
@@ -52,22 +60,29 @@
<td><span t-field="inv.invoice_date"/></td>
<td><span t-field="inv.name"/></td>
<td><span t-field="inv.ref"/></td>
<td t-if="otherCurrency"/>
<td class="text-end"><span t-field="inv.amount_total"/></td>
</tr>
<!-- PAYMENTS/REVERSALS -->
<tr t-foreach="inv._get_reconciled_invoices_partials()[0]" t-as="par">
<t t-set="amount" t-value="par[1]"/>
<t t-set="payment" t-value="par[2].move_id"/>
<td><span t-field="payment.date"/></td>
<td><span t-field="payment.name"/></td>
<td><span t-field="payment.ref"/></td>
<td class="text-end">-<span t-esc="amount" t-options="{'widget': 'monetary', 'display_currency': o.currency_id}"/></td>
<t t-set="amountPayment" t-value="-payment.amount_total"/>
<t t-set="amountInvoice" t-value="-par[1]"/>
<t t-set="currencyPayment" t-value="payment.currency_id"/>
<t t-set="currencyInvoice" t-value="inv.currency_id"/>
<!-- Fill the column "Amount In Currency" only if necessary -->
<td t-if="otherCurrency" class="text-end"><span t-if="currencyPayment != currencyInvoice" t-esc="amountPayment" t-options="{'widget': 'monetary', 'display_currency': currencyPayment}"/></td>
<td class="text-end"><span t-esc="amountInvoice" t-options="{'widget': 'monetary', 'display_currency': currencyInvoice}"/></td>
</tr>
<!-- BALANCE -->
<tr>
<td/>
<td><strong>Due Amount for <span t-field="inv.name"/></strong></td>
<td/>
<td t-if="otherCurrency"/>
<td class="text-end"><strong><span t-field="inv.amount_residual"/></strong></td>
</tr>
</t>