From d891c8d7eac2ddaea28c731e189db7d995950727 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 9 May 2019 18:32:30 +1000 Subject: [PATCH 1/3] Enable 'Submit' button for Move Stock form --- InvenTree/static/script/inventree/stock.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/InvenTree/static/script/inventree/stock.js b/InvenTree/static/script/inventree/stock.js index 3241550ec7..44f563aa51 100644 --- a/InvenTree/static/script/inventree/stock.js +++ b/InvenTree/static/script/inventree/stock.js @@ -293,6 +293,8 @@ function moveStockItems(items, options) { //modalSetContent(modal, html); attachSelect(modal); + modalEnable(modal, true); + $(modal).find('#note-warning').hide(); modalSubmit(modal, function() { From 1a115104d23baeef3af9635a6d6e1bc7468236b2 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 9 May 2019 18:35:55 +1000 Subject: [PATCH 2/3] If a part has no bom items, the 'can_build' function now returns zero --- InvenTree/part/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index deaf2a799a..40eac96a81 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -284,7 +284,7 @@ class Part(models.Model): # If this part does NOT have a BOM, result is simply the currently available stock if not self.has_bom: - return self.available_stock + return 0 total = None From ef9fb5b0183b3da3a61149aba91c248d556f8a25 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 9 May 2019 18:38:37 +1000 Subject: [PATCH 3/3] Hide some fields from forms --- InvenTree/stock/forms.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/InvenTree/stock/forms.py b/InvenTree/stock/forms.py index a94156ad29..c040c58fce 100644 --- a/InvenTree/stock/forms.py +++ b/InvenTree/stock/forms.py @@ -32,13 +32,10 @@ class CreateStockItemForm(HelperForm): 'part', 'supplier_part', 'location', - 'belongs_to', - 'serial', 'batch', 'quantity', 'status', 'notes', - # 'customer', 'URL', ] @@ -67,7 +64,13 @@ class StocktakeForm(forms.ModelForm): class EditStockItemForm(HelperForm): - """ Form for editing a StockItem object """ + """ Form for editing a StockItem object. + Note that not all fields can be edited here (even if they can be specified during creation. + + location - Must be updated in a 'move' transaction + quantity - Must be updated in a 'stocktake' transaction + part - Cannot be edited after creation + """ class Meta: model = StockItem