From 35fc954ff80b44a892812e55cbf30c68226315ce Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 22 Mar 2024 22:15:59 +1100 Subject: [PATCH] Fix for registering scheduled tasks (#6815) (#6816) - Closes https://github.com/inventree/InvenTree/issues/6793 (cherry picked from commit 9576b50152caada788af417405251331a3df2afe) Co-authored-by: Oliver --- InvenTree/plugin/base/integration/ScheduleMixin.py | 2 +- InvenTree/plugin/plugin.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/InvenTree/plugin/base/integration/ScheduleMixin.py b/InvenTree/plugin/base/integration/ScheduleMixin.py index 201f0ea5cd..6a60197d75 100644 --- a/InvenTree/plugin/base/integration/ScheduleMixin.py +++ b/InvenTree/plugin/base/integration/ScheduleMixin.py @@ -112,7 +112,7 @@ class ScheduleMixin: @property def has_scheduled_tasks(self): """Are tasks defined for this plugin.""" - return bool(self.scheduled_tasks) + return bool(self.get_scheduled_tasks()) def validate_scheduled_tasks(self): """Check that the provided scheduled tasks are valid.""" diff --git a/InvenTree/plugin/plugin.py b/InvenTree/plugin/plugin.py index 5b70ac49e1..6cafd510c0 100644 --- a/InvenTree/plugin/plugin.py +++ b/InvenTree/plugin/plugin.py @@ -138,7 +138,13 @@ class MixinBase: if fnc_name is True: return True - return getattr(self, fnc_name, True) + attr = getattr(self, fnc_name, True) + + if callable(attr): + return attr() + else: + return attr + return False def add_mixin(self, key: str, fnc_enabled=True, cls=None):