diff --git a/InvenTree/company/templates/company/detail.html b/InvenTree/company/templates/company/detail.html index e63f217f4b..190efd6cd4 100644 --- a/InvenTree/company/templates/company/detail.html +++ b/InvenTree/company/templates/company/detail.html @@ -283,9 +283,7 @@ }); $("#stock-export").click(function() { - exportStock({ - supplier: {{ company.id }} - }); + downloadTableData($("#stock-table")); }); {% if company.is_manufacturer %} diff --git a/InvenTree/company/templates/company/supplier_part.html b/InvenTree/company/templates/company/supplier_part.html index 89e8f91493..1fe1ea86b4 100644 --- a/InvenTree/company/templates/company/supplier_part.html +++ b/InvenTree/company/templates/company/supplier_part.html @@ -309,11 +309,7 @@ loadStockTable($("#stock-table"), { }); $("#stock-export").click(function() { - - exportStock({ - supplier_part: {{ part.pk }}, - }); - + downloadTableData($("#stock-table")); }); $("#item-create").click(function() { diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index a6cfda757f..172315b50e 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -834,9 +834,7 @@ $("#stock-export").click(function() { - exportStock({ - part: {{ part.pk }} - }); + downloadTableData($("#stock-table")); }); $('#item-create').click(function () { diff --git a/InvenTree/templates/js/translated/stock.js b/InvenTree/templates/js/translated/stock.js index 1ca89368dc..6239a886ab 100644 --- a/InvenTree/templates/js/translated/stock.js +++ b/InvenTree/templates/js/translated/stock.js @@ -43,7 +43,6 @@ duplicateStockItem, editStockItem, editStockLocation, - exportStock, findStockItemBySerialNumber, installStockItem, loadInstalledInTable, @@ -506,49 +505,6 @@ function stockStatusCodes() { } -/* - * Export stock table - */ -function exportStock(params={}) { - - constructFormBody({}, { - title: '{% trans "Export Stock" %}', - fields: { - format: { - label: '{% trans "Format" %}', - help_text: '{% trans "Select file format" %}', - required: true, - type: 'choice', - value: 'csv', - choices: exportFormatOptions(), - }, - sublocations: { - label: '{% trans "Include Sublocations" %}', - help_text: '{% trans "Include stock items in sublocations" %}', - type: 'boolean', - value: 'true', - } - }, - onSubmit: function(fields, form_options) { - - var format = getFormFieldValue('format', fields['format'], form_options); - var cascade = getFormFieldValue('sublocations', fields['sublocations'], form_options); - - // Hide the modal - $(form_options.modal).modal('hide'); - - var url = `{% url "stock-export" %}?format=${format}&cascade=${cascade}`; - - for (var key in params) { - url += `&${key}=${params[key]}`; - } - - location.href = url; - } - }); -} - - /** * Assign multiple stock items to a customer */