mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 04:25:42 +00:00
Display last stocktake information on part page
This commit is contained in:
@ -2161,6 +2161,12 @@ class Part(InvenTreeBarcodeMixin, MetadataMixin, MPTTModel):
|
|||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
@property
|
||||||
|
def latest_stocktake(self):
|
||||||
|
"""Return the latest PartStocktake object associated with this part (if one exists)"""
|
||||||
|
|
||||||
|
return self.stocktakes.order_by('-pk').first()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def has_variants(self):
|
def has_variants(self):
|
||||||
"""Check if this Part object has variants underneath it."""
|
"""Check if this Part object has variants underneath it."""
|
||||||
|
@ -338,6 +338,20 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
{% with part.latest_stocktake as stocktake %}
|
||||||
|
{% if stocktake %}
|
||||||
|
<tr>
|
||||||
|
<td><span class='fas fa-clipboard-check'></span></td>
|
||||||
|
<td>{% trans "Last Stocktake" %}</td>
|
||||||
|
<td>
|
||||||
|
{% decimal stocktake.quantity %} <span class='fas fa-calendar-alt' title='{% render_date stocktake.date %}'></span>
|
||||||
|
<span class='badge bg-dark rounded-pill float-right'>
|
||||||
|
{{ stocktake.user.username }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
{% with part.get_latest_serial_number as sn %}
|
{% with part.get_latest_serial_number as sn %}
|
||||||
{% if part.trackable and sn %}
|
{% if part.trackable and sn %}
|
||||||
<tr>
|
<tr>
|
||||||
|
Reference in New Issue
Block a user