diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py
index 166d70afac..c42f52ec1a 100644
--- a/InvenTree/build/models.py
+++ b/InvenTree/build/models.py
@@ -22,7 +22,7 @@ from markdownx.models import MarkdownxField
from mptt.models import MPTTModel, TreeForeignKey
from InvenTree.status_codes import BuildStatus
-from InvenTree.helpers import increment, getSetting
+from InvenTree.helpers import increment, getSetting, normalize
from InvenTree.validators import validate_build_order_reference
import InvenTree.fields
@@ -589,8 +589,8 @@ class BuildItem(models.Model):
if self.quantity > self.stock_item.quantity:
errors['quantity'] = [_("Allocated quantity ({n}) must not exceed available quantity ({q})".format(
- n=self.quantity,
- q=self.stock_item.quantity
+ n=normalize(self.quantity),
+ q=normalize(self.stock_item.quantity)
))]
if self.stock_item.quantity - self.stock_item.allocation_count() + self.quantity < self.quantity:
diff --git a/InvenTree/build/templates/build/edit_build_item.html b/InvenTree/build/templates/build/edit_build_item.html
new file mode 100644
index 0000000000..99cad71ba2
--- /dev/null
+++ b/InvenTree/build/templates/build/edit_build_item.html
@@ -0,0 +1,10 @@
+{% extends "modal_form.html" %}
+{% load i18n %}
+
+{% block pre_form_content %}
+
+
+ {% trans "Alter the quantity of stock allocated to the build output" %}
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/build/views.py b/InvenTree/build/views.py
index ea4d1905d4..3d3a03b284 100644
--- a/InvenTree/build/views.py
+++ b/InvenTree/build/views.py
@@ -700,7 +700,7 @@ class BuildItemEdit(AjaxUpdateView):
""" View to edit a BuildItem object """
model = BuildItem
- ajax_template_name = 'modal_form.html'
+ ajax_template_name = 'build/edit_build_item.html'
form_class = forms.EditBuildItemForm
ajax_form_title = _('Edit Stock Allocation')
role_required = 'build.change'
@@ -720,14 +720,9 @@ class BuildItemEdit(AjaxUpdateView):
form = super(BuildItemEdit, self).get_form()
- query = StockItem.objects.all()
-
- if build_item.stock_item:
- part_id = build_item.stock_item.part.id
- query = query.filter(part=part_id)
-
- form.fields['stock_item'].queryset = query
-
- form.fields['build'].widget = HiddenInput()
+ # Hide fields which we do not wish the user to edit
+ for field in ['build', 'stock_item', 'install_into']:
+ if form[field].value():
+ form.fields[field].widget = HiddenInput()
return form
diff --git a/InvenTree/templates/js/build.js b/InvenTree/templates/js/build.js
index 0169fc0276..1b330f63b5 100644
--- a/InvenTree/templates/js/build.js
+++ b/InvenTree/templates/js/build.js
@@ -252,7 +252,7 @@ function loadBuildOutputAllocationTable(buildId, partId, output, options={}) {
},
{
field: 'sub_part_detail.full_name',
- title: "{% trans "Required Part" %}",
+ title: '{% trans "Required Part" %}',
sortable: true,
formatter: function(value, row, index, field) {
var url = `/part/${row.sub_part}/`;
@@ -326,7 +326,7 @@ function loadBuildTable(table, options) {
$(table).inventreeTable({
method: 'get',
formatNoMatches: function() {
- return "{% trans "No builds matching query" %}";
+ return '{% trans "No builds matching query" %}';
},
url: options.url,
queryParams: filters,