From ed95cf2a8f097ab788426edec4fabaa211e9a376 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 19 Feb 2024 17:30:40 +1100 Subject: [PATCH] [CI] DB Migration Checks (#6517) * Update imports - Help prevent circular imports * Run migration checks against 0.13.5 --- .github/workflows/qc_checks.yaml | 7 +++++++ InvenTree/InvenTree/serializers.py | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/qc_checks.yaml b/.github/workflows/qc_checks.yaml index 4df9d58812..12be395d76 100644 --- a/.github/workflows/qc_checks.yaml +++ b/.github/workflows/qc_checks.yaml @@ -446,6 +446,13 @@ jobs: chmod +rw /home/runner/work/InvenTree/db.sqlite3 invoke migrate + - name: 0.13.5 Database + run: | + rm /home/runner/work/InvenTree/db.sqlite3 + cp test-db/stable_0.13.5.sqlite3 /home/runner/work/InvenTree/db.sqlite3 + chmod +rw /home/runner/work/InvenTree/db.sqlite3 + invoke migrate + platform_ui: name: Tests - Platform UI runs-on: ubuntu-20.04 diff --git a/InvenTree/InvenTree/serializers.py b/InvenTree/InvenTree/serializers.py index 364d124c03..4745647ea5 100644 --- a/InvenTree/InvenTree/serializers.py +++ b/InvenTree/InvenTree/serializers.py @@ -25,7 +25,6 @@ from taggit.serializers import TaggitSerializer import common.models as common_models from common.settings import currency_code_default, currency_code_mappings from InvenTree.fields import InvenTreeRestURLField, InvenTreeURLField -from InvenTree.helpers_model import download_image_from_url, get_base_url class EmptySerializer(serializers.Serializer): @@ -455,6 +454,8 @@ class UserCreateSerializer(ExendedUserSerializer): def create(self, validated_data): """Send an e email to the user after creation.""" + from InvenTree.helpers_model import get_base_url + base_url = get_base_url() instance = super().create(validated_data) @@ -860,6 +861,8 @@ class RemoteImageMixin(metaclass=serializers.SerializerMetaclass): - Attempt to download the image and store it against this object instance - Catches and re-throws any errors """ + from InvenTree.helpers_model import download_image_from_url + if not url: return