mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
fix migration coverage for build
This commit is contained in:
parent
fe767775bc
commit
e693fe1e41
@ -11,7 +11,7 @@ def update_tree(apps, schema_editor):
|
|||||||
Build.objects.rebuild()
|
Build.objects.rebuild()
|
||||||
|
|
||||||
|
|
||||||
def nupdate_tree(apps, schema_editor):
|
def nupdate_tree(apps, schema_editor): # pragma: no cover
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ def assign_bom_items(apps, schema_editor):
|
|||||||
count_valid = 0
|
count_valid = 0
|
||||||
count_total = 0
|
count_total = 0
|
||||||
|
|
||||||
for build_item in BuildItem.objects.all():
|
for build_item in BuildItem.objects.all(): # pragma: no cover
|
||||||
|
|
||||||
# Try to find a BomItem which matches the BuildItem
|
# Try to find a BomItem which matches the BuildItem
|
||||||
# Note: Before this migration, variant stock assignment was not allowed,
|
# Note: Before this migration, variant stock assignment was not allowed,
|
||||||
@ -45,11 +45,11 @@ def assign_bom_items(apps, schema_editor):
|
|||||||
except BomItem.DoesNotExist:
|
except BomItem.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if count_total > 0:
|
if count_total > 0: # pragma: no cover
|
||||||
logger.info(f"Assigned BomItem for {count_valid}/{count_total} entries")
|
logger.info(f"Assigned BomItem for {count_valid}/{count_total} entries")
|
||||||
|
|
||||||
|
|
||||||
def unassign_bom_items(apps, schema_editor):
|
def unassign_bom_items(apps, schema_editor): # pragma: no cover
|
||||||
"""
|
"""
|
||||||
Reverse migration does not do anything.
|
Reverse migration does not do anything.
|
||||||
Function here to preserve ability to reverse migration
|
Function here to preserve ability to reverse migration
|
||||||
|
@ -21,13 +21,13 @@ def build_refs(apps, schema_editor):
|
|||||||
if result and len(result.groups()) == 1:
|
if result and len(result.groups()) == 1:
|
||||||
try:
|
try:
|
||||||
ref = int(result.groups()[0])
|
ref = int(result.groups()[0])
|
||||||
except:
|
except: # pragma: no cover
|
||||||
ref = 0
|
ref = 0
|
||||||
|
|
||||||
build.reference_int = ref
|
build.reference_int = ref
|
||||||
build.save()
|
build.save()
|
||||||
|
|
||||||
def unbuild_refs(apps, schema_editor):
|
def unbuild_refs(apps, schema_editor): # pragma: no cover
|
||||||
"""
|
"""
|
||||||
Provided only for reverse migration compatibility
|
Provided only for reverse migration compatibility
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user