diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py
index 6bc6160af6..f58f3b4206 100644
--- a/InvenTree/build/models.py
+++ b/InvenTree/build/models.py
@@ -450,7 +450,7 @@ class BuildItem(models.Model):
q=self.stock_item.quantity
))]
- if self.stock_item.quantity - self.stock_item.allocation_count() < self.quantity:
+ if self.stock_item.quantity - self.stock_item.allocation_count() + self.quantity < self.quantity:
errors['quantity'] = _('StockItem is over-allocated')
if self.quantity <= 0:
diff --git a/InvenTree/build/templates/build/allocate.html b/InvenTree/build/templates/build/allocate.html
index 0e4a39cc29..17c6ba7ef6 100644
--- a/InvenTree/build/templates/build/allocate.html
+++ b/InvenTree/build/templates/build/allocate.html
@@ -12,11 +12,13 @@ InvenTree | Allocate Parts
{% include "build/tabs.html" with tab='allocate' %}
@@ -151,7 +153,15 @@ InvenTree | Allocate Parts
field: 'quantity',
title: 'Quantity',
formatter: function(value, row, index, field) {
- return renderLink(value, `/stock/item/${row.stock_item}/`);
+ var text = '';
+
+ if (row.serial && row.quantity == 1) {
+ text = `{% trans "Serial Number" %}: ${row.serial}`;
+ } else {
+ text = `{% trans "Quantity" %}: ${row.quantity}`;
+ }
+
+ return renderLink(text, `/stock/item/${row.stock_item}/`);
},
},
{
@@ -330,8 +340,8 @@ InvenTree | Allocate Parts
],
});
- {% if 0 %}
- $("#auto-allocate-build").on('click', function() {
+ {% if build.status == BuildStatus.PENDING %}
+ $("#btn-allocate").on('click', function() {
launchModalForm(
"{% url 'build-auto-allocate' build.id %}",
{
@@ -339,8 +349,7 @@ InvenTree | Allocate Parts
}
);
});
- {% endif %}
-
+
$('#btn-unallocate').on('click', function() {
launchModalForm(
"{% url 'build-unallocate' build.id %}",
@@ -349,7 +358,7 @@ InvenTree | Allocate Parts
}
);
});
-
+
$("#btn-order-parts").click(function() {
launchModalForm("/order/purchase-order/order-parts/", {
data: {
@@ -357,5 +366,8 @@ InvenTree | Allocate Parts
},
});
});
+
+ {% endif %}
{% endblock %}
+
\ No newline at end of file
diff --git a/InvenTree/build/templates/build/auto_allocate.html b/InvenTree/build/templates/build/auto_allocate.html
index d278b9cd18..fc1e42096b 100644
--- a/InvenTree/build/templates/build/auto_allocate.html
+++ b/InvenTree/build/templates/build/auto_allocate.html
@@ -1,22 +1,23 @@
{% extends "modal_form.html" %}
-
+{% load i18n %}
{% block pre_form_content %}
{{ block.super }}
-Build: {{ build.title }} - {{ build.quantity }} x {{ build.part.full_name }}
-
-Automatically allocate stock to this build?
-
+
+{% trans "Automatically Allocate Stock" %}
+{% trans "Stock Items are selected for automatic allocation if there is only a single stock item available." %}
+{% trans "The following stock items will be allocated to the build:" %}
+
{% if allocations %}
|
- Part |
- Quantity |
- Location |
+ {% trans "Part" %} |
+ {% trans "Quantity" %} |
+ {% trans "Location" %} |
{% for item in allocations %}
@@ -34,7 +35,9 @@ Automatically allocate stock to this build?
{% else %}
-No stock could be selected for automatic build allocation.
+
+ {% trans "No stock items found that can be allocated to this build" %}
+
{% endif %}
{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/part/templates/part/tabs.html b/InvenTree/part/templates/part/tabs.html
index 283afcd2ae..88cdcd587d 100644
--- a/InvenTree/part/templates/part/tabs.html
+++ b/InvenTree/part/templates/part/tabs.html
@@ -49,7 +49,7 @@
{% endif %}
{% if part.trackable %}
-
+
{% trans "Tracking" %}
{% if parts.serials.all|length > 0 %}
{{ part.serials.all|length }}