mirror of
https://gitlab.com/datalifeit/trytond-stock_unit_load
synced 2023-12-14 07:02:59 +01:00
Fix property migration
This commit is contained in:
parent
ec9865b6c1
commit
70e202bf25
|
@ -58,19 +58,22 @@ class ConfigurationSequence:
|
|||
def __register__(cls, module_name):
|
||||
TableHandler = backend.get('TableHandler')
|
||||
exist = TableHandler.table_exist(cls._table)
|
||||
if exist:
|
||||
table = TableHandler(cls, module_name)
|
||||
exist &= table.column_exist('unit_load_sequence')
|
||||
|
||||
super(ConfigurationSequence, cls).__register__(module_name)
|
||||
|
||||
if not exist:
|
||||
# Re-migration
|
||||
cls._migrate_property([], [], [])
|
||||
|
||||
@classmethod
|
||||
def _migrate_property(cls, field_names, value_names, fields):
|
||||
field_names.append('unit_load_sequence')
|
||||
value_names.append('unit_load_sequence')
|
||||
fields.append('company')
|
||||
migrate_property('stock.configuration',
|
||||
field_names, cls, value_names, fields=fields)
|
||||
super(ConfigurationSequence, cls)._migrate_property(field_names,
|
||||
value_names, fields)
|
||||
|
||||
@classmethod
|
||||
def default_unit_load_sequence(cls):
|
||||
|
@ -101,8 +104,8 @@ class ConfigurationULProductionType(ModelSQL, CompanyValueMixin):
|
|||
|
||||
@classmethod
|
||||
def _migrate_property(cls, field_names, value_names, fields):
|
||||
field_names.extend('ul_production_type')
|
||||
value_names.extend('ul_production_type')
|
||||
field_names.append('ul_production_type')
|
||||
value_names.append('ul_production_type')
|
||||
fields.append('company')
|
||||
migrate_property('stock.configuration',
|
||||
field_names, cls, value_names, fields=fields)
|
||||
|
@ -110,4 +113,3 @@ class ConfigurationULProductionType(ModelSQL, CompanyValueMixin):
|
|||
@classmethod
|
||||
def default_ul_production_type(cls):
|
||||
return 'location'
|
||||
|
||||
|
|
Loading…
Reference in a new issue