Fill code compact in party identifier history table
Closes #14983 (grafted from 0d8ca8201d1b54f4f34fb27992b31ce15b276ad2) --HG-- branch : 8.0
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
# this repository contains the full copyright notices and license terms.
|
# this repository contains the full copyright notices and license terms.
|
||||||
from trytond.pool import PoolMeta
|
from trytond.pool import PoolMeta
|
||||||
|
from trytond.transaction import Transaction
|
||||||
|
|
||||||
|
|
||||||
class Party(metaclass=PoolMeta):
|
class Party(metaclass=PoolMeta):
|
||||||
@@ -16,3 +17,19 @@ class Address(metaclass=PoolMeta):
|
|||||||
class Identifier(metaclass=PoolMeta):
|
class Identifier(metaclass=PoolMeta):
|
||||||
__name__ = 'party.identifier'
|
__name__ = 'party.identifier'
|
||||||
_history = True
|
_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]))
|
||||||
|
|||||||
Reference in New Issue
Block a user