mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Change action on deleting top-level stock location
This commit is contained in:
parent
937470750b
commit
86b3092b5e
@ -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():
|
||||
|
@ -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 %}
|
||||
</p>
|
||||
|
||||
@ -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 %}
|
||||
</p>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user