diff --git a/InvenTree/part/templates/part/stock.html b/InvenTree/part/templates/part/stock.html index 3f6f41d1c6..48b16a0f99 100644 --- a/InvenTree/part/templates/part/stock.html +++ b/InvenTree/part/templates/part/stock.html @@ -18,7 +18,6 @@
@@ -111,19 +110,14 @@ return false; }); - $("#multi-item-delete").click(function() { - - var items = selectedStock(); - - deleteStockItems(items, {}); - - return false; - }); - $("#multi-item-stocktake").click(function() { var items = selectedStock(); - countStockItems(items, {}); + countStockItems(items, { + success: function() { + $("#stock-table").bootstrapTable('refresh'); + } + }); return false; }); diff --git a/InvenTree/static/script/inventree/stock.js b/InvenTree/static/script/inventree/stock.js index 7a1bb3f8d6..56f457b53e 100644 --- a/InvenTree/static/script/inventree/stock.js +++ b/InvenTree/static/script/inventree/stock.js @@ -125,6 +125,8 @@ function countStockItems(items, options) { ] }); + $(modal).find('#stocktake-table').bootstrapTable('checkAll'); + $(modal).on('click', '#modal-form-submit', function() { var selections = $(modal).find('#stocktake-table').bootstrapTable('getSelections'); diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 0c55f452c7..892067b4bb 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -57,6 +57,23 @@ class StockItem(models.Model): If a serial number is assigned, then StockItem cannot have a quantity other than 1 """ + def save(self, *args, **kwargs): + if not self.pk: + add_note = True + else: + add_note = False + + super(StockItem, self).save(*args, **kwargs) + + if add_note: + # This StockItem is being saved for the first time + self.add_transaction_note( + 'Created stock item', + None, + system=True + ) + + def clean(self): # The 'supplier_part' field must point to the same part! diff --git a/InvenTree/stock/templates/stock/item.html b/InvenTree/stock/templates/stock/item.html index 890b868d13..9b964ec63b 100644 --- a/InvenTree/stock/templates/stock/item.html +++ b/InvenTree/stock/templates/stock/item.html @@ -118,7 +118,7 @@ {% if track.notes %}