mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
Remove caching of the DEBUG settings from the label printer plugin (#7640)
This commit is contained in:
parent
23a394d740
commit
c87b5c8f3d
@ -35,26 +35,17 @@ class InvenTreeLabelPlugin(LabelPrintingMixin, SettingsMixin, InvenTreePlugin):
|
|||||||
# Keep track of individual label outputs
|
# Keep track of individual label outputs
|
||||||
# These will be stitched together at the end of printing
|
# These will be stitched together at the end of printing
|
||||||
outputs = []
|
outputs = []
|
||||||
debug = None
|
|
||||||
|
|
||||||
def before_printing(self):
|
def before_printing(self):
|
||||||
"""Reset the list of label outputs."""
|
"""Reset the list of label outputs."""
|
||||||
self.outputs = []
|
self.outputs = []
|
||||||
self.debug = None
|
|
||||||
|
|
||||||
def in_debug_mode(self):
|
|
||||||
"""Check if the plugin is printing in debug mode."""
|
|
||||||
if self.debug is None:
|
|
||||||
self.debug = str2bool(self.get_setting('DEBUG'))
|
|
||||||
|
|
||||||
return self.debug
|
|
||||||
|
|
||||||
def print_label(self, **kwargs):
|
def print_label(self, **kwargs):
|
||||||
"""Print a single label."""
|
"""Print a single label."""
|
||||||
label = kwargs['label_instance']
|
label = kwargs['label_instance']
|
||||||
instance = kwargs['item_instance']
|
instance = kwargs['item_instance']
|
||||||
|
|
||||||
if self.in_debug_mode():
|
if str2bool(self.get_setting('DEBUG')):
|
||||||
# In debug mode, return raw HTML output
|
# In debug mode, return raw HTML output
|
||||||
output = self.render_to_html(label, instance, None, **kwargs)
|
output = self.render_to_html(label, instance, None, **kwargs)
|
||||||
else:
|
else:
|
||||||
@ -68,7 +59,7 @@ class InvenTreeLabelPlugin(LabelPrintingMixin, SettingsMixin, InvenTreePlugin):
|
|||||||
if len(self.outputs) == 0:
|
if len(self.outputs) == 0:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if self.in_debug_mode():
|
if str2bool(self.get_setting('DEBUG')):
|
||||||
# Simple HTML output
|
# Simple HTML output
|
||||||
data = '\n'.join(self.outputs)
|
data = '\n'.join(self.outputs)
|
||||||
filename = 'labels.html'
|
filename = 'labels.html'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user