2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 19:46:46 +00:00

Fix for registering scheduled tasks (#6815) (#6816)

- Closes https://github.com/inventree/InvenTree/issues/6793

(cherry picked from commit 9576b50152caada788af417405251331a3df2afe)

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
github-actions[bot] 2024-03-22 22:15:59 +11:00 committed by GitHub
parent ac83318081
commit 35fc954ff8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -112,7 +112,7 @@ class ScheduleMixin:
@property @property
def has_scheduled_tasks(self): def has_scheduled_tasks(self):
"""Are tasks defined for this plugin.""" """Are tasks defined for this plugin."""
return bool(self.scheduled_tasks) return bool(self.get_scheduled_tasks())
def validate_scheduled_tasks(self): def validate_scheduled_tasks(self):
"""Check that the provided scheduled tasks are valid.""" """Check that the provided scheduled tasks are valid."""

View File

@ -138,7 +138,13 @@ class MixinBase:
if fnc_name is True: if fnc_name is True:
return 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 return False
def add_mixin(self, key: str, fnc_enabled=True, cls=None): def add_mixin(self, key: str, fnc_enabled=True, cls=None):