mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 04:25:42 +00:00
Added helper functions, improved UI
This commit is contained in:
@ -26,8 +26,11 @@ class StockLocation(InvenTreeTree):
|
||||
|
||||
@property
|
||||
def items(self):
|
||||
stock_list = self.stockitem_set.all()
|
||||
return stock_list
|
||||
return self.stockitem_set.all()
|
||||
|
||||
@property
|
||||
def has_items(self):
|
||||
return self.items.count() > 0
|
||||
|
||||
|
||||
@receiver(pre_delete, sender=StockLocation, dispatch_uid='stocklocation_delete_log')
|
||||
@ -60,7 +63,6 @@ class StockItem(models.Model):
|
||||
def get_absolute_url(self):
|
||||
return '/stock/item/{id}/'.format(id=self.id)
|
||||
|
||||
|
||||
class Meta:
|
||||
unique_together = [
|
||||
('part', 'serial'),
|
||||
@ -138,7 +140,7 @@ class StockItem(models.Model):
|
||||
|
||||
@property
|
||||
def has_tracking_info(self):
|
||||
return self.tracking_info.all().count() > 0
|
||||
return self.tracking_info.count() > 0
|
||||
|
||||
@transaction.atomic
|
||||
def stocktake(self, count, user):
|
||||
|
@ -5,6 +5,7 @@
|
||||
{% include "stock/loc_link.html" with location=None %}
|
||||
|
||||
{% if locations.all|length > 0 %}
|
||||
<h4>Storage Locations</h4>
|
||||
{% include "stock/location_list.html" with locations=locations %}
|
||||
{% endif %}
|
||||
|
||||
|
@ -4,15 +4,18 @@
|
||||
|
||||
{% include "stock/loc_link.html" with location=location %}
|
||||
|
||||
<p>
|
||||
<b>{{ location.name }}</b><br>
|
||||
<i>{{ location.description }}</i>
|
||||
</p>
|
||||
|
||||
<h3>{{ location.name }}</h3>
|
||||
<p>{{ location.description }}</p>
|
||||
|
||||
{% if location.has_children %}
|
||||
<h4>Sub Locations</h4>
|
||||
{% include "stock/location_list.html" with locations=location.children %}
|
||||
{% endif %}
|
||||
|
||||
{% if location.has_items %}
|
||||
<h4>Stock Items</h4>
|
||||
{% include "stock/stock_table.html" with items=location.items %}
|
||||
{% endif %}
|
||||
|
||||
<div class='container-fluid'>
|
||||
<a href="{% url 'stock-location-create' %}?location={{ location.id }}">
|
||||
|
@ -1,4 +1,3 @@
|
||||
Storage locations:
|
||||
<ul class="list-group">
|
||||
{% for child in locations.all %}
|
||||
<li class="list-group-item"><a href="{% url 'stock-location-detail' child.id %}">{{ child.name }}</a></li>
|
||||
|
Reference in New Issue
Block a user