hook to hourly scheduler
This commit is contained in:
parent
78fb12663a
commit
0ec445214c
@ -290,6 +290,25 @@ class Subscriptions(Document):
|
|||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
|
|
||||||
|
def process_all():
|
||||||
|
subscriptions = get_all_subscriptions()
|
||||||
|
for subscription in subscriptions:
|
||||||
|
process(subscription)
|
||||||
|
|
||||||
|
|
||||||
|
def get_all_subscriptions():
|
||||||
|
return frappe.db.sql(
|
||||||
|
'select name from `tabSubscriptions` where status != "Canceled"',
|
||||||
|
as_dict=1
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def process(data):
|
||||||
|
if data:
|
||||||
|
subscription = frappe.get_doc('Subscriptions', data['name'])
|
||||||
|
subscription.process()
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def cancel_subscription(name):
|
def cancel_subscription(name):
|
||||||
subscription = frappe.get_doc('Subscriptions', name)
|
subscription = frappe.get_doc('Subscriptions', name)
|
||||||
|
|||||||
@ -218,7 +218,8 @@ doc_events = {
|
|||||||
scheduler_events = {
|
scheduler_events = {
|
||||||
"hourly": [
|
"hourly": [
|
||||||
"erpnext.accounts.doctype.subscription.subscription.make_subscription_entry",
|
"erpnext.accounts.doctype.subscription.subscription.make_subscription_entry",
|
||||||
'erpnext.hr.doctype.daily_work_summary_group.daily_work_summary_group.trigger_emails'
|
'erpnext.hr.doctype.daily_work_summary_group.daily_work_summary_group.trigger_emails',
|
||||||
|
"erpnext.assets.doctype.subscriptions.subscriptions.process_all"
|
||||||
],
|
],
|
||||||
"daily": [
|
"daily": [
|
||||||
"erpnext.stock.reorder_item.reorder_item",
|
"erpnext.stock.reorder_item.reorder_item",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user