From e18493a3974b8fd23766963bbd3b0cea22783569 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 26 Mar 2022 13:43:48 +1100 Subject: [PATCH] Supply label width and height to the label printing plugin --- InvenTree/plugin/builtin/integration/mixins.py | 4 ++++ InvenTree/plugin/events.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/InvenTree/plugin/builtin/integration/mixins.py b/InvenTree/plugin/builtin/integration/mixins.py index 451ddaf40f..118f0b775b 100644 --- a/InvenTree/plugin/builtin/integration/mixins.py +++ b/InvenTree/plugin/builtin/integration/mixins.py @@ -419,6 +419,10 @@ class LabelPrintingMixin: Arguments: label: A black-and-white pillow Image object + kwargs: + length: The length of the label (in mm) + width: The width of the label (in mm) + """ # Unimplemented (to be implemented by the particular plugin class) diff --git a/InvenTree/plugin/events.py b/InvenTree/plugin/events.py index cc0e7539b9..b510b42683 100644 --- a/InvenTree/plugin/events.py +++ b/InvenTree/plugin/events.py @@ -217,7 +217,7 @@ def print_label(plugin_slug, label_image, label_instance=None, user=None): return try: - plugin.print_label(label_image) + plugin.print_label(label_image, width=label_instance.width, height=label_instance.height) except Exception as e: # Plugin threw an error - notify the user who attempted to print