fix: only show rest amount for new_aml lines, position it next to the current amount instead of the struck-through source amount

This commit is contained in:
Kristof Bernaert
2026-08-10 21:01:33 +02:00
parent 277b38a0e9
commit b73d268edb
2 changed files with 31 additions and 9 deletions
@@ -23,9 +23,17 @@ class BankRecWidgetLine(models.Model):
compute="_compute_dlv_rest_amount", compute="_compute_dlv_rest_amount",
) )
@api.depends("balance", "source_balance") @api.depends("balance", "source_balance", "flag")
def _compute_dlv_rest_amount(self): def _compute_dlv_rest_amount(self):
# Enkel voor 'new_aml'-regels heeft source_balance een betekenisvolle
# waarde t.o.v. balance (zie _compute_display_stroked_balance in
# bank_rec_widget_line.py van account_accountant). Voor andere
# regels (o.a. de liquidity-regel) staat source_balance gewoon op 0,
# wat zonder deze check een fout restbedrag zou opleveren.
for line in self: for line in self:
if line.flag == "new_aml":
rest = line.source_balance - line.balance rest = line.source_balance - line.balance
else:
rest = 0.0
line.rest_debit = rest if rest > 0.0 else 0.0 line.rest_debit = rest if rest > 0.0 else 0.0
line.rest_credit = -rest if rest < 0.0 else 0.0 line.rest_credit = -rest if rest < 0.0 else 0.0
@@ -3,9 +3,11 @@
<!-- <!--
Voegt het restbedrag (line.rest_debit / line.rest_credit, berekend in Voegt het restbedrag (line.rest_debit / line.rest_credit, berekend in
models/bank_rec_widget_line.py) tussen haakjes toe naast het models/bank_rec_widget_line.py) tussen haakjes toe naast het bedrag
doorgestreepte bronbedrag van een afletteringsregel die niet van de bovenste (huidig ingezette) regel van een afletteringsregel
volledig wordt ingezet (bv. een gedeeltelijk gematchte factuur). die niet volledig wordt gebruikt (bv. een gedeeltelijk gematchte
factuur). rest_debit/rest_credit staan op 0 voor elke regel die geen
'new_aml' is (o.a. de liquidity-regel), dus daar verschijnt niets.
Origineel template: account_accountant.bank_rec_widget_form_lines_widget Origineel template: account_accountant.bank_rec_widget_form_lines_widget
(enterprise-sys/account_accountant/static/src/components/bank_reconciliation/bank_rec_widget.xml) (enterprise-sys/account_accountant/static/src/components/bank_reconciliation/bank_rec_widget.xml)
@@ -13,18 +15,30 @@
Dit is een echt OWL-template, dus we breiden het uit via Dit is een echt OWL-template, dus we breiden het uit via
t-inherit-mode="extension" + <xpath>, zodat de patch automatisch t-inherit-mode="extension" + <xpath>, zodat de patch automatisch
toegepast wordt zonder de JS-component te moeten aanpassen. toegepast wordt zonder de JS-component te moeten aanpassen.
De bovenste rij gebruikt t-out als attribuut rechtstreeks op de
<td> (geen child-elementen), en t-out overschrijft de volledige
inhoud van het element. Om er toch een extra <span> naast te
kunnen tonen, vervangen we de <td> volledig door een variant met
de waarde in een child-<t>, gevolgd door onze rest-span.
--> -->
<t t-name="dlv_account_reconciliation_rest_amount.bank_rec_widget_form_lines_widget" <t t-name="dlv_account_reconciliation_rest_amount.bank_rec_widget_form_lines_widget"
t-inherit="account_accountant.bank_rec_widget_form_lines_widget" t-inherit="account_accountant.bank_rec_widget_form_lines_widget"
t-inherit-mode="extension" t-inherit-mode="extension"
owl="1"> owl="1">
<xpath expr="(//td[@field='debit'])[2]" position="inside"> <xpath expr="(//td[@field='debit'])[1]" position="replace">
<td class="o_data_cell o_field_cell o_list_number" field="debit">
<t t-if="!line.debit.is_zero" t-out="line.debit.display"/>
<span t-if="!line.rest_debit.is_zero" class="dlv_rest_amount text-muted ms-1" title="Nog te matchen"> (<t t-out="line.rest_debit.display"/>)</span> <span t-if="!line.rest_debit.is_zero" class="dlv_rest_amount text-muted ms-1" title="Nog te matchen"> (<t t-out="line.rest_debit.display"/>)</span>
</td>
</xpath> </xpath>
<xpath expr="(//td[@field='credit'])[2]" position="inside"> <xpath expr="(//td[@field='credit'])[1]" position="replace">
<td class="o_data_cell o_field_cell o_list_number" field="credit">
<t t-if="!line.credit.is_zero" t-out="line.credit.display"/>
<span t-if="!line.rest_credit.is_zero" class="dlv_rest_amount text-muted ms-1" title="Nog te matchen"> (<t t-out="line.rest_credit.display"/>)</span> <span t-if="!line.rest_credit.is_zero" class="dlv_rest_amount text-muted ms-1" title="Nog te matchen"> (<t t-out="line.rest_credit.display"/>)</span>
</td>
</xpath> </xpath>
</t> </t>