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",
)
@api.depends("balance", "source_balance")
@api.depends("balance", "source_balance", "flag")
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:
rest = line.source_balance - line.balance
if line.flag == "new_aml":
rest = line.source_balance - line.balance
else:
rest = 0.0
line.rest_debit = rest if rest > 0.0 else 0.0
line.rest_credit = -rest if rest < 0.0 else 0.0