From fdf57891fc224e4a124e53ff2219e63d89bcf6c3 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 25 May 2020 14:16:38 +1000 Subject: [PATCH] Form / view / etc for performing StockItem conversion --- InvenTree/stock/forms.py | 12 ++++++++++ .../stock/templates/stock/item_base.html | 15 ++++++++++++ .../templates/stock/stockitem_convert.html | 17 +++++++++++++ InvenTree/stock/urls.py | 1 + InvenTree/stock/views.py | 24 +++++++++++++++++++ 5 files changed, 69 insertions(+) create mode 100644 InvenTree/stock/templates/stock/stockitem_convert.html diff --git a/InvenTree/stock/forms.py b/InvenTree/stock/forms.py index edf3d28df8..ddd7390246 100644 --- a/InvenTree/stock/forms.py +++ b/InvenTree/stock/forms.py @@ -63,6 +63,18 @@ class EditStockLocationForm(HelperForm): ] +class ConvertStockItemForm(HelperForm): + """ + Form for converting a StockItem to a variant of its current part. + """ + + class Meta: + model = StockItem + fields = [ + 'part' + ] + + class CreateStockItemForm(HelperForm): """ Form for creating a new StockItem """ diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index 819c138988..bc187588d0 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -93,6 +93,11 @@ InvenTree | {% trans "Stock Item" %} - {{ item }} {% endif %} + {% if item.part.has_variants %} + + {% endif %} {% if item.part.has_test_report_templates %}