From 4c7a74ef051073dc49467d9f6d6ca300062a2cef Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 13 Jun 2024 11:34:58 +1000 Subject: [PATCH] Fix for report migration (#7438) - Check that non-nullable fields are not null --- .../InvenTree/report/migrations/0026_auto_20240422_1301.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend/InvenTree/report/migrations/0026_auto_20240422_1301.py b/src/backend/InvenTree/report/migrations/0026_auto_20240422_1301.py index 838a0ae552..5f7bc8afd1 100644 --- a/src/backend/InvenTree/report/migrations/0026_auto_20240422_1301.py +++ b/src/backend/InvenTree/report/migrations/0026_auto_20240422_1301.py @@ -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