diff --git a/InvenTree/build/forms.py b/InvenTree/build/forms.py index a59f4b2f77..81e472bc63 100644 --- a/InvenTree/build/forms.py +++ b/InvenTree/build/forms.py @@ -14,11 +14,7 @@ class EditBuildForm(forms.ModelForm): super(EditBuildForm, self).__init__(*args, **kwargs) self.helper = FormHelper() - self.helper.form_id = 'id-edit-part-form' - self.helper.form_class = 'blueForms' - self.helper.form_method = 'post' - - self.helper.add_input(Submit('submit', 'Submit')) + self.helper.form_tag = False class Meta: model = Build diff --git a/InvenTree/build/templates/build/detail.html b/InvenTree/build/templates/build/detail.html index c412b1ea75..8573fb062c 100644 --- a/InvenTree/build/templates/build/detail.html +++ b/InvenTree/build/templates/build/detail.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% load static %} {% block content %}

Build Details

@@ -35,7 +36,53 @@ {% endif %} +

Required Parts

+ + + + + + + + + + {% for item in build.part.bom_items.all %} + + + + + + {% endfor %} + +
PartRequiredAvailable
{{ item.sub_part.name }}{{ build.quantity }} × {{ item.quantity }}{{ item.sub_part.available_stock }}
+
- + +
+ +{% include 'modals.html' %} + +{% endblock %} + +{% block javascript %} + + + + + {% endblock %} \ No newline at end of file diff --git a/InvenTree/build/views.py b/InvenTree/build/views.py index 66043550f8..8220752f5b 100644 --- a/InvenTree/build/views.py +++ b/InvenTree/build/views.py @@ -11,6 +11,7 @@ from .models import Build from .forms import EditBuildForm +from InvenTree.views import AjaxUpdateView, AjaxCreateView class BuildIndex(ListView): model = Build @@ -38,11 +39,13 @@ class BuildDetail(DetailView): context_object_name = 'build' -class BuildCreate(CreateView): +class BuildCreate(AjaxCreateView): model = Build template_name = 'build/create.html' context_object_name = 'build' form_class = EditBuildForm + ajax_form_title = 'Start new Build' + ajax_template_name = 'modal_form.html' def get_initial(self): initials = super(BuildCreate, self).get_initial().copy() @@ -55,8 +58,10 @@ class BuildCreate(CreateView): return initials -class BuildUpdate(UpdateView): +class BuildUpdate(AjaxUpdateView): model = Build form_class = EditBuildForm context_object_name = 'build' template_name = 'build/update.html' + ajax_form_title = 'Edit Build Details' + ajax_template_name = 'modal_form.html' diff --git a/InvenTree/part/templates/part/build.html b/InvenTree/part/templates/part/build.html index 9f816a2bf2..6b7b74d624 100644 --- a/InvenTree/part/templates/part/build.html +++ b/InvenTree/part/templates/part/build.html @@ -1,5 +1,5 @@ {% extends "part/part_base.html" %} - +{% load static %} {% block details %} {% include 'part/tabs.html' with tab='build' %} @@ -32,6 +32,30 @@
- + +
+ +{% include 'modals.html' %} + +{% endblock %} + +{% block javascript %} + + + + {% endblock %} \ No newline at end of file