mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 04:26:44 +00:00
Display 'net stock' value on front page
This commit is contained in:
parent
50bab299c5
commit
8e82488f70
@ -410,6 +410,19 @@ class Part(models.Model):
|
|||||||
|
|
||||||
return max(total, 0)
|
return max(total, 0)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def net_stock(self):
|
||||||
|
""" Return the 'net' stock. It takes into account:
|
||||||
|
|
||||||
|
- Stock on hand (total_stock)
|
||||||
|
- Stock on order (on_order)
|
||||||
|
- Stock allocated (allocation_count)
|
||||||
|
|
||||||
|
This number (unlike 'available_stock') can be negative.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return self.total_stock - self.allocation_count + self.on_order
|
||||||
|
|
||||||
def isStarredBy(self, user):
|
def isStarredBy(self, user):
|
||||||
""" Return True if this part has been starred by a particular user """
|
""" Return True if this part has been starred by a particular user """
|
||||||
|
|
||||||
|
@ -14,6 +14,10 @@
|
|||||||
color: #ffbb00;
|
color: #ffbb00;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.red-cell {
|
||||||
|
background-color: #ec7f7f;
|
||||||
|
}
|
||||||
|
|
||||||
.part-price {
|
.part-price {
|
||||||
color: rgb(13, 245, 25);
|
color: rgb(13, 245, 25);
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Part</th>
|
<th>Part</th>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
<th>Required</th>
|
|
||||||
<th>In Stock</th>
|
<th>In Stock</th>
|
||||||
<th>On Order</th>
|
<th>On Order</th>
|
||||||
|
<th>Allocted</th>
|
||||||
<th>Net Stock</th>
|
<th>Net Stock</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% for part in parts %}
|
{% for part in parts %}
|
||||||
@ -14,10 +14,10 @@
|
|||||||
<a href="{% url 'part-detail' part.id %}">{{ part.full_name }}</a>
|
<a href="{% url 'part-detail' part.id %}">{{ part.full_name }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ part.description }}</td>
|
<td>{{ part.description }}</td>
|
||||||
<td>{{ part.allocation_count }}</td>
|
|
||||||
<td>{{ part.total_stock }}</td>
|
<td>{{ part.total_stock }}</td>
|
||||||
<td>{{ part.on_order }}</td>
|
<td>{{ part.on_order }}</td>
|
||||||
<td>{{ part.available_stock }}</td>
|
<td>{{ part.allocation_count }}</td>
|
||||||
|
<td{% if part.net_stock < 0 %} class='red-cell'{% endif %}>{{ part.net_stock }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
Loading…
x
Reference in New Issue
Block a user