mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix for report migration (#7438)
- Check that non-nullable fields are not null
This commit is contained in:
parent
06ad599e90
commit
4c7a74ef05
@ -36,6 +36,8 @@ def convert_legacy_labels(table_name, model_name, template_model):
|
||||
'name', 'description', 'label', 'enabled', 'height', 'width', 'filename_pattern', 'filters'
|
||||
]
|
||||
|
||||
non_null_fields = ['decription', 'filename_pattern', 'filters']
|
||||
|
||||
fieldnames = ', '.join(fields)
|
||||
|
||||
query = f"SELECT {fieldnames} FROM {table_name};"
|
||||
@ -56,6 +58,10 @@ def convert_legacy_labels(table_name, model_name, template_model):
|
||||
fields[idx]: row[idx] for idx in range(len(fields))
|
||||
}
|
||||
|
||||
for field in non_null_fields:
|
||||
if data[field] is None:
|
||||
data[field] = ''
|
||||
|
||||
# Skip any "builtin" labels
|
||||
if 'label/inventree/' in data['label']:
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user