diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index b48514976b..4728964e1e 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -38,13 +38,8 @@ def before_delete_stock_location(sender, instance, using, **kwargs): # Update each part in the stock location for item in instance.items.all(): - # If this location has a parent, move the child stock items to the parent - if instance.parent: - item.location = instance.parent - item.save() - # No parent location? Delete the stock items - else: - item.delete() + item.location = instance.parent + item.save() # Update each child category for child in instance.children.all(): diff --git a/InvenTree/stock/templates/stock/location_delete.html b/InvenTree/stock/templates/stock/location_delete.html index 135ed55d51..5bdd5249f6 100644 --- a/InvenTree/stock/templates/stock/location_delete.html +++ b/InvenTree/stock/templates/stock/location_delete.html @@ -11,7 +11,7 @@ If this location is deleted, these child locations will be moved to {% if location.parent %} the '{{ location.parent.name }}' location. {% else %} -the top level 'Stock' category. +the top level 'Stock' location. {% endif %}

@@ -27,7 +27,7 @@ the top level 'Stock' category. {% if location.parent %} If this location is deleted, these items will be moved to the '{{ location.parent.name }}' location. {% else %} -If this location is deleted, these items will be deleted! +If this location is deleted, these items will be moved to the top level 'Stock' location. {% endif %}