From 027e1cf130e41afafe4a6e011ea40d0c1bbbb1e4 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 9 May 2019 23:06:19 +1000 Subject: [PATCH] Add ability to edit 'delete_on_deplete' field --- InvenTree/stock/forms.py | 2 ++ InvenTree/stock/models.py | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/InvenTree/stock/forms.py b/InvenTree/stock/forms.py index c040c58fce..f181a6db88 100644 --- a/InvenTree/stock/forms.py +++ b/InvenTree/stock/forms.py @@ -34,6 +34,7 @@ class CreateStockItemForm(HelperForm): 'location', 'batch', 'quantity', + 'delete_on_deplete', 'status', 'notes', 'URL', @@ -78,6 +79,7 @@ class EditStockItemForm(HelperForm): fields = [ 'supplier_part', 'batch', + 'delete_on_deplete', 'status', 'notes', 'URL', diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index a5f323268a..2caa3940cd 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -286,9 +286,9 @@ class StockItem(models.Model): self.location = location self.addTransactionNote(msg, - user, - notes=notes, - system=True) + user, + notes=notes, + system=True) self.save() @@ -296,8 +296,8 @@ class StockItem(models.Model): @transaction.atomic def updateQuantity(self, quantity): - """ Update stock quantity for this item. - + """ Update stock quantity for this item. + If the quantity has reached zero, this StockItem will be deleted. Returns: