details:   https://code.tryton.org/tryton/commit/0016d22389b8
branch:    default
user:      Cédric Krier <[email protected]>
date:      Fri Jun 05 15:50:42 2026 +0200
description:
        Use also maturity date to calculate reconciliation date
diffstat:

 doc/migration.rst         |  17 +++++++++++++++++
 modules/account/CHANGELOG |   1 +
 modules/account/move.py   |   6 ++++--
 3 files changed, 22 insertions(+), 2 deletions(-)

diffs (58 lines):

diff -r f6f8c6aa4316 -r 0016d22389b8 doc/migration.rst
--- a/doc/migration.rst Thu Jun 18 19:09:35 2026 +0200
+++ b/doc/migration.rst Fri Jun 05 15:50:42 2026 +0200
@@ -14,6 +14,23 @@
 .. warning::
    You cannot skip more than 2 series ending with ``.0``.
 
+.. _migration-8.2:
+
+8.2
+---
+
+.. _migration-8.2-after:
+
+After
+~~~~~
+
+* If ``account`` module is activated, update the reconciliation date using
+  maturity date:
+
+  .. code-block:: SQL
+
+      UPDATE "account_move_reconciliation" AS r SET date = (SELECT 
GREATEST(MAX(l.maturity_date), MAX(m.date)) FROM account_move_line AS l JOIN 
account_move AS m ON l.move = m.id WHERE l.reconciliation = r.id);
+
 .. _migration-8.0:
 
 8.0
diff -r f6f8c6aa4316 -r 0016d22389b8 modules/account/CHANGELOG
--- a/modules/account/CHANGELOG Thu Jun 18 19:09:35 2026 +0200
+++ b/modules/account/CHANGELOG Fri Jun 05 15:50:42 2026 +0200
@@ -1,3 +1,4 @@
+* Use also maturity date to calculate reconciliation date
 
 Version 8.0.0 - 2026-04-20
 --------------------------
diff -r f6f8c6aa4316 -r 0016d22389b8 modules/account/move.py
--- a/modules/account/move.py   Thu Jun 18 19:09:35 2026 +0200
+++ b/modules/account/move.py   Fri Jun 05 15:50:42 2026 +0200
@@ -1079,7 +1079,7 @@
         cls._check_modify_exclude = {
             'maturity_date', 'reconciliation', 'tax_lines'}
         cls._reconciliation_modify_disallow = {
-            'account', 'debit', 'credit', 'party',
+            'account', 'debit', 'credit', 'party', 'maturity_date',
             }
         table = cls.__table__()
         cls._sql_constraints += [
@@ -1673,7 +1673,9 @@
             reconciliations.append({
                     'company': reconcile_account.company,
                     'lines': [('add', [x.id for x in lines])],
-                    'date': max(l.date for l in lines),
+                    'date': max(filter(None,
+                            (d for l in lines
+                                for d in (l.maturity_date, l.date)))),
                     'delegate_to': delegate_to,
                     })
         if to_post:

Reply via email to