details:   https://code.tryton.org/tryton/commit/400747a5c849
branch:    8.0
user:      Cédric Krier <[email protected]>
date:      Mon Aug 03 12:26:11 2026 +0200
description:
        Fill code compact in party identifier history table

        Closes #14983
        (grafted from 0d8ca8201d1b54f4f34fb27992b31ce15b276ad2)
diffstat:

 modules/account_invoice_history/party.py |  17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diffs (31 lines):

diff -r b030003ca20a -r 400747a5c849 modules/account_invoice_history/party.py
--- a/modules/account_invoice_history/party.py  Thu Aug 06 15:59:39 2026 +0200
+++ b/modules/account_invoice_history/party.py  Mon Aug 03 12:26:11 2026 +0200
@@ -1,6 +1,7 @@
 # This file is part of Tryton.  The COPYRIGHT file at the top level of
 # this repository contains the full copyright notices and license terms.
 from trytond.pool import PoolMeta
+from trytond.transaction import Transaction
 
 
 class Party(metaclass=PoolMeta):
@@ -16,3 +17,19 @@
 class Identifier(metaclass=PoolMeta):
     __name__ = 'party.identifier'
     _history = True
+
+    @classmethod
+    def __register__(cls, module_name):
+        cursor = Transaction().connection.cursor()
+        table = cls.__table_history__()
+        table_h = cls.__table_handler__(module_name=module_name, history=True)
+
+        fill_code_compact = (
+            table_h.column_exist('code')
+            and not table_h.column_exist('code_compact'))
+
+        super().__register__(module_name)
+
+        # Migration from 7.8: Fill code_compact
+        if fill_code_compact:
+            cursor.execute(*table.update([table.code_compact], [table.code]))

Reply via email to