2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 03:00:54 +00:00

Add a "completed" field to the Build model

- Keeps track of how many outputs have been produced
- Will not be directly editable by the user
This commit is contained in:
Oliver Walters
2020-10-20 23:59:37 +11:00
parent fd6d630037
commit e02536071d
7 changed files with 183 additions and 124 deletions

View File

@ -130,7 +130,7 @@ class StockItem(MPTTModel):
status: Status of this StockItem (ref: InvenTree.status_codes.StockStatus)
notes: Extra notes field
build: Link to a Build (if this stock item was created from a build)
is_building: Boolean field indicating if this stock item is currently being built
is_building: Boolean field indicating if this stock item is currently being built (or is "in production")
purchase_order: Link to a PurchaseOrder (if this stock item was created from a PurchaseOrder)
infinite: If True this StockItem can never be exhausted
sales_order: Link to a SalesOrder object (if the StockItem has been assigned to a SalesOrder)

View File

@ -15,6 +15,20 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
{% block pre_content %}
{% include 'stock/loc_link.html' with location=item.location %}
{% if item.is_building %}
<div class='alert alert-block alert-info'>
{% trans "This stock item is in production and cannot be edited." %}<br>
{% trans "Edit the stock item from the build view." %}<br>
{% if item.build %}
<a href="{% url 'build-detail' item.build.id %}">
<b>{{ item.build }}</b>
</a>
{% endif %}
</div>
{% endif %}
{% if item.hasRequiredTests and not item.passedAllRequiredTests %}
<div class='alert alert-block alert-danger'>
{% trans "This stock item has not passed all required tests" %}
@ -79,7 +93,6 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
<div class='btn-group' role='group'>
</div>
<div class='btn-group action-buttons' role='group'>
@ -99,7 +112,7 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
</ul>
</div>
<!-- Stock adjustment menu -->
{% if roles.stock.change %}
{% if roles.stock.change and not item.is_building %}
<div class='btn-group'>
<button id='stock-options' title='{% trans "Stock adjustment actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-boxes'></span> <span class='caret'></span></button>
<ul class='dropdown-menu' role='menu'>
@ -129,7 +142,7 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
</div>
{% endif %}
<!-- Edit stock item -->
{% if roles.stock.change %}
{% if roles.stock.change and not item.is_building %}
<div class='btn-group'>
<button id='stock-edit-actions' title='{% trans "Stock actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-tools'></span> <span class='caret'></span></button>
<ul class='dropdown-menu' role='menu'>
@ -221,7 +234,7 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
{% if item.location %}
<td><a href="{% url 'stock-location-detail' item.location.id %}">{{ item.location.name }}</a></td>
{% else %}
<td>{% trans "No location set" %}</td>
<td><i>{% trans "No location set" %}</i></td>
{% endif %}
</tr>
{% endif %}
@ -290,7 +303,7 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
{% if item.stocktake_date %}
<td>{{ item.stocktake_date }} <span class='badge'>{{ item.stocktake_user }}</span></td>
{% else %}
<td>{% trans "No stocktake performed" %}</td>
<td><i>{% trans "No stocktake performed" %}</i></td>
{% endif %}
</tr>
<tr>