mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Short-circuit the custom migration if there are no SupplierPart objects
- This allows the unit testing to run!
This commit is contained in:
parent
2839f94773
commit
f243b567fd
@ -15,8 +15,6 @@ class StatusCode:
|
|||||||
Render the value as a label.
|
Render the value as a label.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
print("Rendering:", key, cls.options)
|
|
||||||
|
|
||||||
# If the key cannot be found, pass it back
|
# If the key cannot be found, pass it back
|
||||||
if key not in cls.options.keys():
|
if key not in cls.options.keys():
|
||||||
return key
|
return key
|
||||||
|
@ -21,6 +21,12 @@ def reverse_association(apps, schema_editor):
|
|||||||
into the 'manufacturer_name' field.
|
into the 'manufacturer_name' field.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Exit if there are no SupplierPart objects
|
||||||
|
# This crucial otherwise the unit test suite fails!
|
||||||
|
if SupplierPart.objects.count() == 0:
|
||||||
|
print("No SupplierPart objects - skipping")
|
||||||
|
return
|
||||||
|
|
||||||
print("Reversing migration for manufacturer association")
|
print("Reversing migration for manufacturer association")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -49,6 +55,12 @@ def associate_manufacturers(apps, schema_editor):
|
|||||||
It uses fuzzy pattern matching to help the user out as much as possible.
|
It uses fuzzy pattern matching to help the user out as much as possible.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Exit if there are no SupplierPart objects
|
||||||
|
# This crucial otherwise the unit test suite fails!
|
||||||
|
if SupplierPart.objects.count() == 0:
|
||||||
|
print("No SupplierPart objects - skipping")
|
||||||
|
return
|
||||||
|
|
||||||
# Link a 'manufacturer_name' to a 'Company'
|
# Link a 'manufacturer_name' to a 'Company'
|
||||||
links = {}
|
links = {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user