Repository: inventree/InvenTree

Issue:
[FR]Add option to remember the last used label type
### Please verify that this feature request has NOT been suggested before.

- [X] I checked and didn't find a similar feature request

### Problem statement

When printing labels the label type is always set to the first label type available. 
When printing labels with the label type other than the first the label type always need to be selected.
This is could be quite inconvenient.

### Suggested solution

Set autocomplete flag on the label type comboboxes.

If this approach approved/supported/non concerned I can fix it quite easily.

### Describe alternatives you've considered

Adding field/table for the a "favourite" label type per user per label type (part/stock/stocklocation).

### Examples of other systems

N/A

### Do you want to develop this?

- [X] I want to develop this.


Discussion:
That's quite reasonable, this could easily be a user setting (or one user setting per type of label).
> That's quite reasonable, this could easily be a user setting (or one user setting per type of label).

Do we want to provide UI for this purpose or we just want to remember the last used type (i.e. extend the autocomplete behavior profile -not browser session- wide)?
I don't think it needs to be exposed to the settings UI, but could easily be done as a future step if we wanted. 

Resolving patch:
diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py
--- a/InvenTree/common/models.py
+++ b/InvenTree/common/models.py
@@ -2100,7 +2100,35 @@ class Meta:
                 MinValueValidator(0),
             ],
             'default': 100,
-        }
+        },
+
+        'DEFAULT_PART_LABEL_TEMPLATE': {
+            'name': _('Default part label template'),
+            'description': _('The part label template to be automatically selected'),
+            'validator': [
+                int,
+            ],
+            'default': '',
+        },
+
+        'DEFAULT_ITEM_LABEL_TEMPLATE': {
+            'name': _('Default stock item template'),
+            'description': _('The stock item label template to be automatically selected'),
+            'validator': [
+                int,
+            ],
+            'default': '',
+        },
+
+        'DEFAULT_LOCATION_LABEL_TEMPLATE': {
+            'name': _('Default stock location label template'),
+            'description': _('The stock location label template to be automatically selected'),
+            'validator': [
+                int,
+            ],
+            'default': '',
+        },
+
     }
 
     typ = 'user'
diff --git a/InvenTree/label/api.py b/InvenTree/label/api.py
--- a/InvenTree/label/api.py
+++ b/InvenTree/label/api.py
@@ -148,6 +148,8 @@ def dispatch(self, *args, **kwargs):
 
     def get(self, request, *args, **kwargs):
         """Perform a GET request against this endpoint to print labels"""
+        common.models.InvenTreeUserSetting.set_setting('DEFAULT_' + self.ITEM_KEY.upper() + '_LABEL_TEMPLATE',
+                                                       self.get_object().pk, None, user=request.user)
         return self.print(request, self.get_items())
 
     def get_plugin(self, request):


Test patch: