diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index 3f251fd0b8..9eac812ae0 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -46,6 +46,7 @@ import InvenTree.ready import InvenTree.tasks import InvenTree.validators import order.validators +from plugin import registry logger = logging.getLogger('inventree') @@ -1628,6 +1629,15 @@ class InvenTreeSetting(BaseInvenTreeSetting): return False +def label_printer_options(): + """Build a list of available label printer options.""" + printers = [('', _('No Printer (Export to PDF)'))] + label_printer_plugins = registry.with_mixin('labels') + if label_printer_plugins: + printers.extend([(p.slug, p.name + ' - ' + p.human_name) for p in label_printer_plugins]) + return printers + + class InvenTreeUserSetting(BaseInvenTreeSetting): """An InvenTreeSetting object with a usercontext.""" @@ -1781,6 +1791,13 @@ class InvenTreeUserSetting(BaseInvenTreeSetting): 'validator': bool, }, + "LABEL_DEFAULT_PRINTER": { + 'name': _('Default label printer'), + 'description': _('Configure which label printer should be selected by default'), + 'default': '', + 'choices': label_printer_options + }, + "REPORT_INLINE": { 'name': _('Inline report display'), 'description': _('Display PDF reports in the browser, instead of downloading as a file'), diff --git a/InvenTree/templates/InvenTree/settings/user_labels.html b/InvenTree/templates/InvenTree/settings/user_labels.html index 93c7c0b2bc..85492a2b98 100644 --- a/InvenTree/templates/InvenTree/settings/user_labels.html +++ b/InvenTree/templates/InvenTree/settings/user_labels.html @@ -15,6 +15,7 @@