mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-05 23:08:48 +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
|
# Update each part in the stock location
|
||||||
for item in instance.items.all():
|
for item in instance.items.all():
|
||||||
# If this location has a parent, move the child stock items to the parent
|
item.location = instance.parent
|
||||||
if instance.parent:
|
item.save()
|
||||||
item.location = instance.parent
|
|
||||||
item.save()
|
|
||||||
# No parent location? Delete the stock items
|
|
||||||
else:
|
|
||||||
item.delete()
|
|
||||||
|
|
||||||
# Update each child category
|
# Update each child category
|
||||||
for child in instance.children.all():
|
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 %}
|
{% if location.parent %}
|
||||||
the '{{ location.parent.name }}' location.
|
the '{{ location.parent.name }}' location.
|
||||||
{% else %}
|
{% else %}
|
||||||
the top level 'Stock' category.
|
the top level 'Stock' location.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ the top level 'Stock' category.
|
|||||||
{% if location.parent %}
|
{% if location.parent %}
|
||||||
If this location is deleted, these items will be moved to the '{{ location.parent.name }}' location.
|
If this location is deleted, these items will be moved to the '{{ location.parent.name }}' location.
|
||||||
{% else %}
|
{% 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 %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user