mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-01 13:06:45 +00:00
Generate modal form to export BOM
- Doesn't do anything yet - Extends AjaxView
This commit is contained in:
parent
73b7c178d4
commit
0cc59540ef
@ -18,6 +18,10 @@
|
|||||||
<button type='button' class='btn btn-success' id='new-bom-item'>Add BOM Item</button>
|
<button type='button' class='btn btn-success' id='new-bom-item'>Add BOM Item</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class='container-fluid'>
|
||||||
|
<button type='button' class='btn btn-basic' id='export-bom'>Export BOM</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block js_ready %}
|
{% block js_ready %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
@ -57,6 +61,19 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#export-bom").click(function () {
|
||||||
|
launchModalForm(
|
||||||
|
"{% url 'bom-export' part.id %}",
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
reload: true,
|
||||||
|
data: {
|
||||||
|
format: 'csv',
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$("#bom-table").bootstrapTable({
|
$("#bom-table").bootstrapTable({
|
||||||
sortable: true,
|
sortable: true,
|
||||||
search: true,
|
search: true,
|
||||||
|
3
InvenTree/part/templates/part/bom_export.html
Normal file
3
InvenTree/part/templates/part/bom_export.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Export BOM for {{ part.name }}
|
||||||
|
|
||||||
|
{% include "modal_csrf.html" %}
|
@ -20,6 +20,7 @@ part_detail_urls = [
|
|||||||
url(r'^delete/?', views.PartDelete.as_view(), name='part-delete'),
|
url(r'^delete/?', views.PartDelete.as_view(), name='part-delete'),
|
||||||
url(r'^track/?', views.PartDetail.as_view(template_name='part/track.html'), name='part-track'),
|
url(r'^track/?', views.PartDetail.as_view(template_name='part/track.html'), name='part-track'),
|
||||||
url(r'^bom/?', views.PartDetail.as_view(template_name='part/bom.html'), name='part-bom'),
|
url(r'^bom/?', views.PartDetail.as_view(template_name='part/bom.html'), name='part-bom'),
|
||||||
|
url(r'^export-bom/?', views.BomExport.as_view(), name='bom-export'),
|
||||||
url(r'^build/?', views.PartDetail.as_view(template_name='part/build.html'), name='part-build'),
|
url(r'^build/?', views.PartDetail.as_view(template_name='part/build.html'), name='part-build'),
|
||||||
url(r'^stock/?', views.PartDetail.as_view(template_name='part/stock.html'), name='part-stock'),
|
url(r'^stock/?', views.PartDetail.as_view(template_name='part/stock.html'), name='part-stock'),
|
||||||
url(r'^used/?', views.PartDetail.as_view(template_name='part/used_in.html'), name='part-used-in'),
|
url(r'^used/?', views.PartDetail.as_view(template_name='part/used_in.html'), name='part-used-in'),
|
||||||
|
@ -18,7 +18,7 @@ from .forms import EditBomItemForm
|
|||||||
|
|
||||||
from .forms import EditSupplierPartForm
|
from .forms import EditSupplierPartForm
|
||||||
|
|
||||||
from InvenTree.views import AjaxCreateView, AjaxUpdateView, AjaxDeleteView
|
from InvenTree.views import AjaxView, AjaxCreateView, AjaxUpdateView, AjaxDeleteView
|
||||||
|
|
||||||
|
|
||||||
class PartIndex(ListView):
|
class PartIndex(ListView):
|
||||||
@ -110,6 +110,28 @@ class PartEdit(AjaxUpdateView):
|
|||||||
ajax_form_title = 'Edit Part Properties'
|
ajax_form_title = 'Edit Part Properties'
|
||||||
|
|
||||||
|
|
||||||
|
class BomExport(AjaxView):
|
||||||
|
|
||||||
|
model = Part
|
||||||
|
template_name = 'part/bom_export.html'
|
||||||
|
#ajax_template_name = 'modal_form.html'
|
||||||
|
ajax_form_title = 'Export Bill of Materials'
|
||||||
|
ajax_submit_text = 'Export'
|
||||||
|
context_object_name = 'part'
|
||||||
|
fields = []
|
||||||
|
|
||||||
|
def post(self, request, *args, **kwargs):
|
||||||
|
|
||||||
|
part = get_object_or_404(Part, pk=self.kwargs['pk'])
|
||||||
|
|
||||||
|
return self.renderJsonResponse(request, None)
|
||||||
|
|
||||||
|
def get_data(self):
|
||||||
|
return {
|
||||||
|
'info': 'Exported BOM'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class PartDelete(AjaxDeleteView):
|
class PartDelete(AjaxDeleteView):
|
||||||
model = Part
|
model = Part
|
||||||
template_name = 'part/delete.html'
|
template_name = 'part/delete.html'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user