From c0b0999cb04f189e8b8766f41e85d834c0848edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 3 Aug 2026 12:26:11 +0200 Subject: [PATCH] Fill code compact in party identifier history table Closes #14983 (grafted from 0d8ca8201d1b54f4f34fb27992b31ce15b276ad2) --HG-- branch : 8.0 --- modules/account_invoice_history/party.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/account_invoice_history/party.py b/modules/account_invoice_history/party.py index 535e2283dd..4daf00d06d 100644 --- a/modules/account_invoice_history/party.py +++ b/modules/account_invoice_history/party.py @@ -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 Address(metaclass=PoolMeta): 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]))