mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Changed 'stocklocation.items' to 'stocklocation.stock_items'
This commit is contained in:
parent
2d21bf0626
commit
84d2d2e45b
@ -27,19 +27,19 @@ class StockLocation(InvenTreeTree):
|
||||
return '/stock/location/{id}/'.format(id=self.id)
|
||||
|
||||
@property
|
||||
def items(self):
|
||||
def stock_items(self):
|
||||
return self.stockitem_set.all()
|
||||
|
||||
@property
|
||||
def has_items(self):
|
||||
return self.items.count() > 0
|
||||
return self.stock_items.count() > 0
|
||||
|
||||
|
||||
@receiver(pre_delete, sender=StockLocation, dispatch_uid='stocklocation_delete_log')
|
||||
def before_delete_stock_location(sender, instance, using, **kwargs):
|
||||
|
||||
# Update each part in the stock location
|
||||
for item in instance.items.all():
|
||||
for item in instance.stock_items.all():
|
||||
item.location = instance.parent
|
||||
item.save()
|
||||
|
||||
|
@ -19,8 +19,8 @@ the top level 'Stock' location.
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if location.items.all|length > 0 %}
|
||||
<p>This location contains {{ location.items.all|length }} stock items.<br>
|
||||
{% if location.stock_items.all|length > 0 %}
|
||||
<p>This location contains {{ location.stock_items.all|length }} stock items.<br>
|
||||
{% if location.parent %}
|
||||
If this location is deleted, these items will be moved to the '{{ location.parent.name }}' location.
|
||||
{% else %}
|
||||
@ -29,7 +29,7 @@ If this location is deleted, these items will be moved to the top level 'Stock'
|
||||
</p>
|
||||
|
||||
<ul class='list-group'>
|
||||
{% for item in location.items.all %}
|
||||
{% for item in location.stock_items.all %}
|
||||
<li class='list-group-item'><b>{{ item.part.name }}</b> - <i>{{ item.part.description }}</i><span class='badge'>{{ item.quantity }}</span></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user