diff --git a/InvenTree/build/forms.py b/InvenTree/build/forms.py
index 47c9b8612c..b3f6cd92de 100644
--- a/InvenTree/build/forms.py
+++ b/InvenTree/build/forms.py
@@ -15,7 +15,7 @@ from InvenTree.fields import DatePickerFormField
from InvenTree.status_codes import StockStatus
-from .models import Build, BuildItem
+from .models import Build
from stock.models import StockLocation, StockItem
@@ -244,22 +244,3 @@ class CancelBuildForm(HelperForm):
fields = [
'confirm_cancel'
]
-
-
-class EditBuildItemForm(HelperForm):
- """
- Form for creating (or editing) a BuildItem object.
- """
-
- quantity = RoundingDecimalFormField(max_digits=10, decimal_places=5, label=_('Quantity'), help_text=_('Select quantity of stock to allocate'))
-
- part_id = forms.IntegerField(required=False, widget=forms.HiddenInput())
-
- class Meta:
- model = BuildItem
- fields = [
- 'build',
- 'stock_item',
- 'quantity',
- 'install_into',
- ]
diff --git a/InvenTree/build/templates/build/create_build_item.html b/InvenTree/build/templates/build/create_build_item.html
deleted file mode 100644
index cc23bd49a9..0000000000
--- a/InvenTree/build/templates/build/create_build_item.html
+++ /dev/null
@@ -1,20 +0,0 @@
-{% extends "modal_form.html" %}
-{% load i18n %}
-
-{% block pre_form_content %}
-
-
- {% trans "Select a stock item to allocate to the selected build output" %}
-
- {% if output %}
-
- {% blocktrans %}The allocated stock will be installed into the following build output:
{{output}}{% endblocktrans %}
-
- {% endif %}
-
-{% if no_stock %}
-
- {% blocktrans %}No stock available for {{part}}{% endblocktrans %}
-
-{% endif %}
-{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/build/views.py b/InvenTree/build/views.py
index 82f9f3586b..702b3b3596 100644
--- a/InvenTree/build/views.py
+++ b/InvenTree/build/views.py
@@ -11,13 +11,13 @@ from django.views.generic import DetailView, ListView
from django.forms import HiddenInput
from part.models import Part
-from .models import Build, BuildItem
+from .models import Build
from . import forms
from stock.models import StockLocation, StockItem
-from InvenTree.views import AjaxUpdateView, AjaxCreateView, AjaxDeleteView
+from InvenTree.views import AjaxUpdateView, AjaxDeleteView
from InvenTree.views import InvenTreeRoleMixin
-from InvenTree.helpers import str2bool, extract_serial_numbers, normalize, isNull
+from InvenTree.helpers import str2bool, extract_serial_numbers, isNull
from InvenTree.status_codes import BuildStatus, StockStatus
@@ -565,220 +565,3 @@ class BuildDelete(AjaxDeleteView):
model = Build
ajax_template_name = 'build/delete_build.html'
ajax_form_title = _('Delete Build Order')
-
-
-class BuildItemCreate(AjaxCreateView):
- """
- View for allocating a StockItem to a build output.
- """
-
- model = BuildItem
- form_class = forms.EditBuildItemForm
- ajax_template_name = 'build/create_build_item.html'
- ajax_form_title = _('Allocate stock to build output')
-
- # The output StockItem against which the allocation is being made
- output = None
-
- # The "part" which is being allocated to the output
- part = None
-
- available_stock = None
-
- def get_context_data(self):
- """
- Provide context data to the template which renders the form.
- """
-
- ctx = super().get_context_data()
-
- if self.part:
- ctx['part'] = self.part
-
- if self.output:
- ctx['output'] = self.output
-
- if self.available_stock:
- ctx['stock'] = self.available_stock
- else:
- ctx['no_stock'] = True
-
- return ctx
-
- def validate(self, build_item, form, **kwargs):
- """
- Extra validation steps as required
- """
-
- data = form.cleaned_data
-
- stock_item = data.get('stock_item', None)
- quantity = data.get('quantity', None)
-
- if stock_item:
- # Stock item must actually be in stock!
- if not stock_item.in_stock:
- form.add_error('stock_item', _('Item must be currently in stock'))
-
- # Check that there are enough items available
- if quantity is not None:
- available = stock_item.unallocated_quantity()
- if quantity > available:
- form.add_error('stock_item', _('Stock item is over-allocated'))
- form.add_error('quantity', _('Available') + ': ' + str(normalize(available)))
- else:
- form.add_error('stock_item', _('Stock item must be selected'))
-
- def get_form(self):
- """ Create Form for making / editing new Part object """
-
- form = super(AjaxCreateView, self).get_form()
-
- self.build = None
- self.part = None
- self.output = None
-
- # If the Build object is specified, hide the input field.
- # We do not want the users to be able to move a BuildItem to a different build
- build_id = form['build'].value()
-
- if build_id is not None:
- """
- If the build has been provided, hide the widget to change the build selection.
- Additionally, update the allowable selections for other fields.
- """
- form.fields['build'].widget = HiddenInput()
- form.fields['install_into'].queryset = StockItem.objects.filter(build=build_id, is_building=True)
- self.build = Build.objects.get(pk=build_id)
- else:
- """
- Build has *not* been selected
- """
- pass
-
- # If the sub_part is supplied, limit to matching stock items
- part_id = form['part_id'].value()
-
- if part_id:
- try:
- self.part = Part.objects.get(pk=part_id)
-
- except (ValueError, Part.DoesNotExist):
- pass
-
- # If the output stock item is specified, hide the input field
- output_id = form['install_into'].value()
-
- if output_id is not None:
-
- try:
- self.output = StockItem.objects.get(pk=output_id)
- form.fields['install_into'].widget = HiddenInput()
- except (ValueError, StockItem.DoesNotExist):
- pass
-
- else:
- # If the output is not specified, but we know that the part is non-trackable, hide the install_into field
- if self.part and not self.part.trackable:
- form.fields['install_into'].widget = HiddenInput()
-
- if self.build and self.part:
- available_items = self.build.availableStockItems(self.part, self.output)
-
- form.fields['stock_item'].queryset = available_items
-
- self.available_stock = form.fields['stock_item'].queryset.all()
-
- # If there is only a single stockitem available, select it!
- if len(self.available_stock) == 1:
- form.fields['stock_item'].initial = self.available_stock[0].pk
-
- return form
-
- def get_initial(self):
- """ Provide initial data for BomItem. Look for the folllowing in the GET data:
-
- - build: pk of the Build object
- - part: pk of the Part object which we are assigning
- - output: pk of the StockItem object into which the allocated stock will be installed
- """
-
- initials = super(AjaxCreateView, self).get_initial().copy()
-
- build_id = self.get_param('build')
- part_id = self.get_param('part')
- output_id = self.get_param('install_into')
-
- # Reference to a Part object
- part = None
-
- # Reference to a StockItem object
- item = None
-
- # Reference to a Build object
- build = None
-
- # Reference to a StockItem object
- output = None
-
- if part_id:
- try:
- part = Part.objects.get(pk=part_id)
- initials['part_id'] = part.pk
- except Part.DoesNotExist:
- pass
-
- if build_id:
- try:
- build = Build.objects.get(pk=build_id)
- initials['build'] = build
- except Build.DoesNotExist:
- pass
-
- # If the output has been specified
- if output_id:
- try:
- output = StockItem.objects.get(pk=output_id)
- initials['install_into'] = output
- except (ValueError, StockItem.DoesNotExist):
- pass
-
- # Work out how much stock is required
- if build and part:
- required_quantity = build.unallocatedQuantity(part, output)
- else:
- required_quantity = None
-
- quantity = self.request.GET.get('quantity', None)
-
- if quantity is not None:
- quantity = float(quantity)
- elif required_quantity is not None:
- quantity = required_quantity
-
- item_id = self.get_param('item')
-
- # If the request specifies a particular StockItem
- if item_id:
- try:
- item = StockItem.objects.get(pk=item_id)
- except (ValueError, StockItem.DoesNotExist):
- pass
-
- # If a StockItem is not selected, try to auto-select one
- if item is None and part is not None:
- items = StockItem.objects.filter(part=part)
- if items.count() == 1:
- item = items.first()
-
- # Finally, if a StockItem is selected, ensure the quantity is not too much
- if item is not None:
- if quantity is None:
- quantity = item.unallocated_quantity()
- else:
- quantity = min(quantity, item.unallocated_quantity())
-
- if quantity is not None:
- initials['quantity'] = quantity
-
- return initials
diff --git a/InvenTree/templates/js/translated/build.js b/InvenTree/templates/js/translated/build.js
index d1226259cd..325cb962a2 100644
--- a/InvenTree/templates/js/translated/build.js
+++ b/InvenTree/templates/js/translated/build.js
@@ -176,15 +176,6 @@ function makeBuildOutputActionButtons(output, buildInfo, lines) {
success: reloadTable,
}
);
-
- return;
- launchModalForm(`/build/${buildId}/auto-allocate/`,
- {
- data: {
- },
- success: reloadTable,
- }
- );
});
$(panel).find(`#button-output-complete-${outputId}`).click(function() {