Switch to registry for tasks (#3790)

* Add general registering functions
Fixes #3787

* switch over to new method

* move to static type

* fix unclear naming
This commit is contained in:
Matthias Mair
2022-10-17 09:53:59 +11:00
committed by GitHub
parent 182bc29053
commit 0bea2c7b56
5 changed files with 84 additions and 61 deletions
+3 -1
View File
@@ -6,12 +6,13 @@ from django.utils.translation import gettext_lazy as _
import common.notifications
import InvenTree.helpers
import InvenTree.tasks
import order.models
from InvenTree.status_codes import PurchaseOrderStatus, SalesOrderStatus
from InvenTree.tasks import ScheduledTask, scheduled_task
from plugin.events import trigger_event
@scheduled_task(ScheduledTask.DAILY)
def notify_overdue_purchase_order(po: order.models.PurchaseOrder):
"""Notify users that a PurchaseOrder has just become 'overdue'"""
@@ -55,6 +56,7 @@ def notify_overdue_purchase_order(po: order.models.PurchaseOrder):
)
@scheduled_task(ScheduledTask.DAILY)
def check_overdue_purchase_orders():
"""Check if any outstanding PurchaseOrders have just become overdue: