From 61f77d0e6e9c553aa55f7132cdcc61350a926a8d Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 15 May 2024 13:14:26 +1000 Subject: [PATCH] Update for label printing --- inventree/label.py | 14 +++++++------- inventree/report.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/inventree/label.py b/inventree/label.py index 4cc8543..cae489e 100644 --- a/inventree/label.py +++ b/inventree/label.py @@ -17,11 +17,11 @@ class LabelPrintingMixin: Classes which implement this mixin should define the following attributes: - Legacy API: < 197 + Legacy API: < 198 - LABELNAME: The name of the label type (e.g. 'part', 'stock', 'location') - LABELITEM: The name of the label item (e.g. 'parts', 'items', 'locations') - Modern API: >= 197 + Modern API: >= 198 - MODEL_TYPE: The model type for the label printing class (e.g. 'part', 'stockitem', 'location') """ @@ -125,11 +125,11 @@ def printLabelModern(self, template, plugin=None, destination=None, *args, **kwa } if plugin is not None: - # For the modern printing API, plugin is provided as a pk (integer) value - if type(plugin) is int: - plugin = int(plugin) - elif hasattr(plugin, 'pk'): - plugin = int(plugin.pk) + # For the modern printing API, plugin is provided as a key (string) value + if type(plugin) is str: + pass + elif hasattr(plugin, 'key'): + plugin = int(plugin.key) else: raise ValueError(f"Invalid plugin provided: {type(plugin)}") diff --git a/inventree/report.py b/inventree/report.py index 633ea21..aff9e6e 100644 --- a/inventree/report.py +++ b/inventree/report.py @@ -17,7 +17,7 @@ class ReportPrintingMixin: - REPORTNAME: The name of the report type, as given in the API (e.g. 'bom', 'build', 'po') - REPORTITEM: The name of items send to the report print endpoint. - Modern API: >= 197 + Modern API: >= 198 - MODEL_TYPE: The model type of the report (e.g. 'purchaseorder', 'stocklocation') """