Skip to content

Commit

Permalink
Update for label printing
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingersGat committed May 15, 2024
1 parent b0bbbcb commit 61f77d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions inventree/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
"""

Expand Down Expand Up @@ -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)}")

Expand Down
2 changes: 1 addition & 1 deletion inventree/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
"""

Expand Down

0 comments on commit 61f77d0

Please sign in to comment.