mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Simplify new plugin class
This commit is contained in:
parent
4e041e97b9
commit
86b5655c5f
@ -397,8 +397,9 @@ class LabelPrintingMixin:
|
|||||||
"""
|
"""
|
||||||
Mixin which enables direct printing of stock labels.
|
Mixin which enables direct printing of stock labels.
|
||||||
|
|
||||||
Each plugin should provide a PRINTER_NAME attribute,
|
Each plugin must provide a PLUGIN_NAME attribute, which is used to uniquely identify the printer.
|
||||||
and also implement the print_label() function
|
|
||||||
|
The plugin must also implement the print_label() function
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class MixinMeta:
|
class MixinMeta:
|
||||||
@ -409,17 +410,7 @@ class LabelPrintingMixin:
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.add_mixin('labels', 'has_label_printing', __class__)
|
self.add_mixin('labels', True, __class__)
|
||||||
|
|
||||||
@property
|
|
||||||
def has_label_printing(self):
|
|
||||||
|
|
||||||
if not bool(self.PRINTER_NAME):
|
|
||||||
raise ValueError("PRINTER_NAME must be defined")
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
PRINTER_NAME = "LabelPrinter"
|
|
||||||
|
|
||||||
def get_printer_name(self):
|
def get_printer_name(self):
|
||||||
return self.PRINTER_NAME
|
return self.PRINTER_NAME
|
||||||
|
Loading…
Reference in New Issue
Block a user