feat: add dlv_account_reconciliation_rest_amount — show rest amount on bank reconciliation screen

This commit is contained in:
Kristof Bernaert
2026-08-10 20:21:04 +02:00
parent 99be24c46a
commit a529d6fd01
7 changed files with 178 additions and 0 deletions
@@ -0,0 +1,55 @@
odoo.define('dlv_account_reconciliation_rest_amount.reconciliation_renderer', function (require) {
"use strict";
/**
* Toont het restbedrag (het verschil tussen het volledige bedrag van een
* regel en het bedrag dat effectief wordt ingezet om af te letteren) tussen
* haakjes op het afletterscherm.
*
* Dit geldt zowel voor de bankbeweging zelf (de liquidity-line) als voor een
* toegevoegde boeking (bv. een aankoopfactuur) waarvan niet het volledige
* bedrag wordt gebruikt (line.partial_amount != line.amount).
*/
var ReconciliationRenderer = require('account.ReconciliationRenderer');
var field_utils = require('web.field_utils');
ReconciliationRenderer.ManualLineRenderer.include({
/**
* @override
*/
update: function (state) {
this._computeRestAmounts(state);
return this._super.apply(this, arguments);
},
/**
* Berekent, voor elke regel in de afletteringsvoorstellen die slechts
* gedeeltelijk wordt ingezet, het nog resterende (niet-afgeletterde)
* bedrag en formatteert dit als rest_amount_str.
*
* @private
* @param {Object} state
*/
_computeRestAmounts: function (state) {
var format_options = {currency_id: state.st_line.currency_id};
_.each(state.reconciliation_proposition, function (line) {
if (!line) {
return;
}
var hasPartialAmount = line.partial_amount && Math.abs(line.partial_amount) !== Math.abs(line.amount);
if (hasPartialAmount) {
var rest = Math.abs(line.amount) - Math.abs(line.partial_amount);
line.rest_amount = rest;
line.rest_amount_str = field_utils.format.monetary(rest, {}, format_options);
} else {
delete line.rest_amount;
delete line.rest_amount_str;
}
});
},
});
});
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<!--
Voegt het restbedrag (line.rest_amount_str, berekend in
reconciliation_rest_amount.js) tussen haakjes toe naast het bedrag
van een afletteringsregel. Geldt zowel voor de bankbeweging
(liquidity-line) als voor een toegevoegde boeking waarvan niet het
volledige bedrag wordt ingezet.
Origineel template: reconciliation.line.mv_line.amount
(enterprise-sys/account_accountant/static/src/xml/account_reconciliation.xml)
-->
<xpath expr="//t[@t-name='reconciliation.line.mv_line.amount']//span[hasclass('line_amount')][2]" position="after">
<span t-if="line.rest_amount_str" class="dlv_rest_amount text-muted" title="Nog te matchen"> (<t t-out="line.rest_amount_str"/>)</span>
</xpath>
</templates>