mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-03 22:55:43 +00:00 
			
		
		
		
	Export stock based on part
This commit is contained in:
		@@ -76,12 +76,14 @@ function loadStockTable(table, options) {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            else if (field == 'quantity') {
 | 
					            else if (field == 'quantity') {
 | 
				
			||||||
                var stock = 0;
 | 
					                var stock = 0;
 | 
				
			||||||
 | 
					                var items = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                data.forEach(function(item) {
 | 
					                data.forEach(function(item) {
 | 
				
			||||||
                    stock += item.quantity; 
 | 
					                    stock += item.quantity; 
 | 
				
			||||||
 | 
					                    items += 1;
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return stock;
 | 
					                return stock + " (" + items + " items)";
 | 
				
			||||||
            } else if (field == 'batch') {
 | 
					            } else if (field == 'batch') {
 | 
				
			||||||
                var batches = [];
 | 
					                var batches = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,6 +47,21 @@
 | 
				
			|||||||
        url: "{% url 'api-stock-list' %}",
 | 
					        url: "{% url 'api-stock-list' %}",
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $("#stock-export").click(function() {
 | 
				
			||||||
 | 
					        launchModalForm("{% url 'stock-export-options' %}", {
 | 
				
			||||||
 | 
					            submit_text: "Export",
 | 
				
			||||||
 | 
					            success: function(response) {
 | 
				
			||||||
 | 
					                var url = "{% url 'stock-export' %}";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                url += "?format=" + response.format;
 | 
				
			||||||
 | 
					                url += "&cascade=" + response.cascade;
 | 
				
			||||||
 | 
					                url += "&part={{ part.id }}";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                location.href = url;
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $('#item-create').click(function () {
 | 
					    $('#item-create').click(function () {
 | 
				
			||||||
        launchModalForm("{% url 'stock-item-create' %}", {
 | 
					        launchModalForm("{% url 'stock-item-create' %}", {
 | 
				
			||||||
            reload: true,
 | 
					            reload: true,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user