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,14 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.0] - 2026-08-10
### Added
- Initial release.
- Show the rest (still open) amount in parentheses on the bank
reconciliation screen, for both the bank movement line and any partially
used added invoice/bill line.
@@ -0,0 +1,46 @@
# dlv_account_reconciliation_rest_amount
## Overview
`dlv_account_reconciliation_rest_amount` extends the standard bank
reconciliation screen (Accounting → Reconciliation) so the still-open
("rest") amount of a line is shown in parentheses next to its total.
On the reconciliation screen, when a proposed line (the bank movement itself,
or an added invoice/bill) is only partially used to close the statement line,
Odoo shows the full amount struck through and the partial amount used above
it — but not what remains unmatched on that line. This addon adds that
missing number, e.g.:
```
€ 1.899,97
€ 4.486,35 (€ 2.586,38)
```
so the user immediately sees that €2.586,38 of that invoice is still
outstanding, without having to search for it elsewhere.
## How it works
- `static/src/js/reconciliation_rest_amount.js` patches
`account.ReconciliationRenderer`'s `ManualLineRenderer.update()`. Before
every render, it walks `state.reconciliation_proposition` and, for any line
where `partial_amount` differs from `amount`, computes and formats the
difference as `line.rest_amount_str`.
- `static/src/xml/reconciliation_rest_amount.xml` inherits the shared
`reconciliation.line.mv_line.amount` template (from `account_accountant`)
via xpath and prints `line.rest_amount_str` between parentheses, right
after the existing amount.
Because both the bank movement (liquidity line) and any added invoice/bill
proposition are rendered through the same loop and template, this single
patch covers both cases.
## Dependencies
- `account_accountant`
## Installation
Standard addon install/update. No configuration or data is added; the change
is purely visual on the existing reconciliation widget.
@@ -0,0 +1,16 @@
# Roadmap
Planned extensions to the reconciliation rest-amount addon. Items are grouped
by target release and are subject to change.
## v1.1 — Suggest matching entries by rest amount
- When a line's rest amount matches (exactly, or within a small tolerance)
another open entry for the same partner, surface it as a suggested match
in the "Match with existing entries" tab instead of requiring the user to
find it manually.
## Future — Configurable tolerance / rounding
- Allow a small configurable rounding tolerance when comparing rest amounts,
to account for currency rounding differences.
@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
{
"name": "Reconciliation Rest Amount",
"summary": "Toon het restbedrag tussen haakjes op het afletterscherm "
"(bank reconciliatie)",
"description": """
Voegt het restbedrag (verschil tussen het oorspronkelijke bedrag en het reeds
afgeletterde/toegewezen bedrag) tussen haakjes toe aan het bank-afletterscherm,
zowel bij de regel van het bankafschrift (liquidity-line) als bij de
voorgestelde afletteringsregels (bestaande boekingen) die niet volledig
worden ingezet.
""",
"author": "bv Domus La Vila",
"website": "https://domuslavila.eu",
"category": "Accounting/Accounting",
"version": "16.0.1.0.0",
"license": "LGPL-3",
"depends": ["account_accountant"],
"data": [],
"assets": {
"web.assets_backend": [
"dlv_account_reconciliation_rest_amount/static/src/js/*.js",
"dlv_account_reconciliation_rest_amount/static/src/xml/*.xml",
],
},
"installable": True,
"application": False,
"auto_install": False,
}
@@ -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>