fix: allow disabling logging on CRON jobs (#25742)

Some crons are very very small duration and don't require logging
either. We should let users decide if they want to disable logging.
This commit is contained in:
Ankush Menat 2024-03-30 11:51:56 +05:30 committed by GitHub
parent f32c3aa3a8
commit 561617d5db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -39,7 +39,7 @@
},
{
"default": "0",
"depends_on": "eval:doc.frequency==='All'",
"depends_on": "eval:[\"All\", \"Cron\"].includes(doc.frequency)",
"fieldname": "create_log",
"fieldtype": "Check",
"label": "Create Log"
@ -102,7 +102,7 @@
"link_fieldname": "scheduled_job_type"
}
],
"modified": "2024-03-23 16:03:37.925078",
"modified": "2024-03-30 11:39:49.693632",
"modified_by": "Administrator",
"module": "Core",
"name": "Scheduled Job Type",

View file

@ -1,6 +1,7 @@
# Copyright (c) 2021, Frappe Technologies and contributors
# License: MIT. See LICENSE
import contextlib
import json
from datetime import datetime, timedelta
from random import randint
@ -48,8 +49,8 @@ class ScheduledJobType(Document):
# end: auto-generated types
def validate(self):
if self.frequency != "All":
# force logging for all events other than continuous ones (ALL)
if self.frequency not in ("All", "Cron"):
# force logging for all events other than All/Cron
self.create_log = 1
if self.frequency == "Cron":