From 77cfadad42fbcaccac680dc6d168e406b2f087ee Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 12 Jul 2021 21:11:29 +1000 Subject: [PATCH] Add 'title' option for contsructed fields --- InvenTree/stock/api.py | 4 ---- InvenTree/templates/js/forms.js | 5 +++++ InvenTree/templates/js/stock.js | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py index 91810dddc6..08e948607a 100644 --- a/InvenTree/stock/api.py +++ b/InvenTree/stock/api.py @@ -120,9 +120,6 @@ class StockAdjust(APIView): - StockAdd: add stock items - StockRemove: remove stock items - StockTransfer: transfer stock items - - # TODO - This needs serious refactoring!!! - """ queryset = StockItem.objects.none() @@ -502,7 +499,6 @@ class StockList(generics.ListCreateAPIView): serializer = self.get_serializer(data=request.data) serializer.is_valid(raise_exception=True) - # TODO - Save the user who created this item item = serializer.save() # A location was *not* specified - try to infer it diff --git a/InvenTree/templates/js/forms.js b/InvenTree/templates/js/forms.js index a9747d8f7d..b71551747c 100644 --- a/InvenTree/templates/js/forms.js +++ b/InvenTree/templates/js/forms.js @@ -1473,6 +1473,11 @@ function constructInputOptions(name, classes, type, parameters) { opts.push(`required=''`); } + // Custom mouseover title? + if (parameters.title != null) { + opts.push(`title='${parameters.title}'`); + } + // Placeholder? if (parameters.placeholder != null) { opts.push(`placeholder='${parameters.placeholder}'`); diff --git a/InvenTree/templates/js/stock.js b/InvenTree/templates/js/stock.js index 6ce4c3aae4..f173f868f7 100644 --- a/InvenTree/templates/js/stock.js +++ b/InvenTree/templates/js/stock.js @@ -147,6 +147,7 @@ function adjustStock(action, items, options={}) { min_value: minValue, max_value: maxValue, read_only: readonly, + title: readonly ? '{% trans "Quantity cannot be adjusted for serialized stock" %}' : '{% trans "Specify stock quantity" %}', } ) };