diff --git a/InvenTree/plugin/integration.py b/InvenTree/plugin/integration.py index 0aaecfd28c..8d56d63db7 100644 --- a/InvenTree/plugin/integration.py +++ b/InvenTree/plugin/integration.py @@ -275,6 +275,7 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin): PUBLISH_DATE = None VERSION = None WEBSITE = None + LICENSE = None def __init__(self): super().__init__() @@ -347,6 +348,12 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin): name = getattr(self, 'WEBSITE', None) return name + @property + def license(self): + """returns license of plugin""" + license = getattr(self, 'LICENSE', None) + return license + @property def package_path(self): """returns the path to the plugin""" diff --git a/InvenTree/plugin/test_integration.py b/InvenTree/plugin/test_integration.py index 9493d2a237..3befdf6b00 100644 --- a/InvenTree/plugin/test_integration.py +++ b/InvenTree/plugin/test_integration.py @@ -166,6 +166,7 @@ class IntegrationPluginBaseTests(TestCase): DESCRIPTION = 'A description' VERSION = '1.2.3a' WEBSITE = 'http://aa.bb/cc' + LICENSE = 'MIT' self.plugin_name = NameIntegrationPluginBase() @@ -206,3 +207,8 @@ class IntegrationPluginBaseTests(TestCase): self.assertEqual(self.plugin.website, None) self.assertEqual(self.plugin_simple.website, None) self.assertEqual(self.plugin_name.website, 'http://aa.bb/cc') + + # license + self.assertEqual(self.plugin.license, None) + self.assertEqual(self.plugin_simple.license, None) + self.assertEqual(self.plugin_name.license, 'MIT') diff --git a/InvenTree/templates/InvenTree/settings/plugin_settings.html b/InvenTree/templates/InvenTree/settings/plugin_settings.html index cb5ed85d6d..22e81e1873 100644 --- a/InvenTree/templates/InvenTree/settings/plugin_settings.html +++ b/InvenTree/templates/InvenTree/settings/plugin_settings.html @@ -55,6 +55,13 @@ {{ plugin.website }}{% include "clip.html" %} {% endif %} + {% if plugin.license %} + + + {% trans "License" %} + {{ plugin.license }}{% include "clip.html" %} + + {% endif %} {% if plugin.is_package == False %}