diff --git a/InvenTree/plugin/base/action/mixins.py b/InvenTree/plugin/base/action/mixins.py index 540859f2b4..b978a69189 100644 --- a/InvenTree/plugin/base/action/mixins.py +++ b/InvenTree/plugin/base/action/mixins.py @@ -12,6 +12,7 @@ class ActionMixin: MIXIN_NAME = 'Actions' def __init__(self): + """Register mixin.""" super().__init__() self.add_mixin('action', True, __class__) diff --git a/InvenTree/plugin/base/barcodes/mixins.py b/InvenTree/plugin/base/barcodes/mixins.py index e57d67d5fd..5ba90d7157 100644 --- a/InvenTree/plugin/base/barcodes/mixins.py +++ b/InvenTree/plugin/base/barcodes/mixins.py @@ -40,6 +40,7 @@ class BarcodeMixin: MIXIN_NAME = 'Barcode' def __init__(self): + """Register mixin.""" super().__init__() self.add_mixin('barcode', 'has_barcode', __class__) diff --git a/InvenTree/plugin/base/label/mixins.py b/InvenTree/plugin/base/label/mixins.py index 7fac8a4971..268f3e063f 100644 --- a/InvenTree/plugin/base/label/mixins.py +++ b/InvenTree/plugin/base/label/mixins.py @@ -17,6 +17,7 @@ class LabelPrintingMixin: MIXIN_NAME = 'Label printing' def __init__(self): # pragma: no cover + """Register mixin.""" super().__init__() self.add_mixin('labels', True, __class__) diff --git a/InvenTree/plugin/builtin/action/simpleactionplugin.py b/InvenTree/plugin/builtin/action/simpleactionplugin.py index e9a77a86b9..af4b404764 100644 --- a/InvenTree/plugin/builtin/action/simpleactionplugin.py +++ b/InvenTree/plugin/builtin/action/simpleactionplugin.py @@ -11,13 +11,16 @@ class SimpleActionPlugin(ActionMixin, InvenTreePlugin): ACTION_NAME = "simple" def perform_action(self, user=None, data=None): + """Sample method.""" print("Action plugin in action!") def get_info(self, user, data=None): + """Sample method.""" return { "user": user.username, "hello": "world", } def get_result(self, user=None, data=None): + """Sample method.""" return True diff --git a/InvenTree/plugin/builtin/barcodes/inventree_barcode.py b/InvenTree/plugin/builtin/barcodes/inventree_barcode.py index e21684e1ee..52e97ddbd6 100644 --- a/InvenTree/plugin/builtin/barcodes/inventree_barcode.py +++ b/InvenTree/plugin/builtin/barcodes/inventree_barcode.py @@ -18,12 +18,14 @@ from stock.models import StockItem, StockLocation class InvenTreeBarcodePlugin(BarcodeMixin, InvenTreePlugin): + """Builtin BarcodePlugin for matching and generating internal barcodes.""" NAME = "InvenTreeBarcode" def validate(self): - """An "InvenTree" barcode must be a jsonnable-dict with the following tags: + """Validate a barcode. + An "InvenTree" barcode must be a jsonnable-dict with the following tags: { 'tool': 'InvenTree', 'version': @@ -52,7 +54,7 @@ class InvenTreeBarcodePlugin(BarcodeMixin, InvenTreePlugin): return True def getStockItem(self): - + """Lookup StockItem by 'stockitem' key in barcode data.""" for k in self.data.keys(): if k.lower() == 'stockitem': @@ -81,7 +83,7 @@ class InvenTreeBarcodePlugin(BarcodeMixin, InvenTreePlugin): return None def getStockLocation(self): - + """Lookup StockLocation by 'stocklocation' key in barcode data.""" for k in self.data.keys(): if k.lower() == 'stocklocation': @@ -109,7 +111,7 @@ class InvenTreeBarcodePlugin(BarcodeMixin, InvenTreePlugin): return None def getPart(self): - + """Lookup Part by 'part' key in barcode data.""" for k in self.data.keys(): if k.lower() == 'part': diff --git a/InvenTree/plugin/builtin/integration/core_notifications.py b/InvenTree/plugin/builtin/integration/core_notifications.py index 9358eb3a61..d5c3cffd51 100644 --- a/InvenTree/plugin/builtin/integration/core_notifications.py +++ b/InvenTree/plugin/builtin/integration/core_notifications.py @@ -11,7 +11,13 @@ from plugin.mixins import BulkNotificationMethod, SettingsMixin class PlgMixin: + """Mixin to access plugin easier. + + This needs to be spit out to reference the class. Perks of python. + """ + def get_plugin(self): + """Return plugin reference.""" return CoreNotificationsPlugin @@ -32,6 +38,8 @@ class CoreNotificationsPlugin(SettingsMixin, InvenTreePlugin): } class EmailNotification(PlgMixin, BulkNotificationMethod): + """Notificationmethod for delivery via Email.""" + METHOD_NAME = 'mail' METHOD_ICON = 'fa-envelope' CONTEXT_EXTRA = [ @@ -62,6 +70,7 @@ class CoreNotificationsPlugin(SettingsMixin, InvenTreePlugin): ) def send_bulk(self): + """Send the notifications out via email.""" html_message = render_to_string(self.context['template']['html'], self.context) targets = self.targets.values_list('email', flat=True)