Skip to content

Commit

Permalink
Merge pull request #21175 from frappe/version-14-hotfix
Browse files Browse the repository at this point in the history
chore: release v14
  • Loading branch information
phot0n committed May 30, 2023
2 parents 52540bc + b5bc4ba commit c16249a
Show file tree
Hide file tree
Showing 54 changed files with 1,698 additions and 478 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ jobs:
pip install pip-audit
cd ${GITHUB_WORKSPACE}
sed -i '/dropbox/d' pyproject.toml # Remove dropbox temporarily https://github.com/dropbox/dropbox-sdk-python/pull/456
pip-audit .
pip-audit --desc on --ignore-vuln GHSA-4xqq-73wg-5mjp .
135 changes: 60 additions & 75 deletions frappe/automation/workspace/tools/tools.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"charts": [],
"content": "[{\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Your Shortcuts</b></span>\",\"col\":12}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"ToDo\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Note\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"File\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Assignment Rule\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Auto Repeat\",\"col\":3}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Reports & Masters</b></span>\",\"col\":12}},{\"type\":\"card\",\"data\":{\"card_name\":\"Tools\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Email\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Automation\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Event Streaming\",\"col\":4}}]",
"content": "[{\"id\":\"-P-RG1wVHg\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Your Shortcuts</b></span>\",\"col\":12}},{\"id\":\"sR-UFcO7II\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Import Data\",\"col\":3}},{\"id\":\"IkcVmgWb3z\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"ToDo\",\"col\":3}},{\"id\":\"6wir-jZFRE\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"File\",\"col\":3}},{\"id\":\"45a1jzQkTm\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Assignment Rule\",\"col\":3}},{\"id\":\"LdZrgvxxo7\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"yNSSTIaDWZ\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Documents</b></span>\",\"col\":12}},{\"id\":\"0yceBIfhHM\",\"type\":\"card\",\"data\":{\"card_name\":\"Data\",\"col\":4}},{\"id\":\"42WbBA9rpj\",\"type\":\"card\",\"data\":{\"card_name\":\"Tools\",\"col\":4}},{\"id\":\"7_U7_xCOos\",\"type\":\"card\",\"data\":{\"card_name\":\"Email\",\"col\":4}},{\"id\":\"SlYKJZj5r3\",\"type\":\"card\",\"data\":{\"card_name\":\"Automation\",\"col\":4}}]",
"creation": "2020-03-02 14:53:24.980279",
"custom_blocks": [],
"docstatus": 0,
"doctype": "Workspace",
"for_user": "",
"hide_custom": 0,
"icon": "tool",
"idx": 0,
"is_hidden": 0,
"label": "Tools",
"links": [
{
"hidden": 0,
"is_query_report": 0,
"label": "Tools",
"label": "Email",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
Expand All @@ -22,9 +24,9 @@
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "To Do",
"label": "Newsletter",
"link_count": 0,
"link_to": "ToDo",
"link_to": "Newsletter",
"link_type": "DocType",
"onboard": 1,
"type": "Link"
Expand All @@ -33,31 +35,39 @@
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Calendar",
"label": "Email Group",
"link_count": 0,
"link_to": "Event",
"link_to": "Email Group",
"link_type": "DocType",
"onboard": 1,
"onboard": 0,
"type": "Link"
},
{
"hidden": 0,
"is_query_report": 0,
"label": "Automation",
"link_count": 3,
"onboard": 0,
"type": "Card Break"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Note",
"label": "Assignment Rule",
"link_count": 0,
"link_to": "Note",
"link_to": "Assignment Rule",
"link_type": "DocType",
"onboard": 1,
"onboard": 0,
"type": "Link"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Files",
"label": "Milestone",
"link_count": 0,
"link_to": "File",
"link_to": "Milestone",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
Expand All @@ -66,28 +76,28 @@
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Activity",
"label": "Auto Repeat",
"link_count": 0,
"link_to": "activity",
"link_type": "Page",
"link_to": "Auto Repeat",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
},
{
"hidden": 0,
"is_query_report": 0,
"label": "Email",
"link_count": 0,
"label": "Tools",
"link_count": 4,
"onboard": 0,
"type": "Card Break"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Newsletter",
"label": "To Do",
"link_count": 0,
"link_to": "Newsletter",
"link_to": "ToDo",
"link_type": "DocType",
"onboard": 1,
"type": "Link"
Expand All @@ -96,137 +106,117 @@
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Email Group",
"link_count": 0,
"link_to": "Email Group",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
},
{
"hidden": 0,
"is_query_report": 0,
"label": "Automation",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Assignment Rule",
"label": "Calendar",
"link_count": 0,
"link_to": "Assignment Rule",
"link_to": "Event",
"link_type": "DocType",
"onboard": 0,
"onboard": 1,
"type": "Link"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Milestone",
"label": "Note",
"link_count": 0,
"link_to": "Milestone",
"link_to": "Note",
"link_type": "DocType",
"onboard": 0,
"onboard": 1,
"type": "Link"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Auto Repeat",
"label": "Files",
"link_count": 0,
"link_to": "Auto Repeat",
"link_to": "File",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
},
{
"hidden": 0,
"is_query_report": 0,
"label": "Event Streaming",
"link_count": 0,
"label": "Data",
"link_count": 5,
"onboard": 0,
"type": "Card Break"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Event Producer",
"label": "Import Data",
"link_count": 0,
"link_to": "Event Producer",
"link_to": "Data Import",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Event Consumer",
"label": "Export Data",
"link_count": 0,
"link_to": "Event Consumer",
"link_to": "Data Export",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Event Update Log",
"label": "Bulk Update",
"link_count": 0,
"link_to": "Event Update Log",
"link_to": "Bulk Update",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Event Sync Log",
"label": "Download Backups",
"link_count": 0,
"link_to": "Event Sync Log",
"link_type": "DocType",
"link_to": "backups",
"link_type": "Page",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Document Type Mapping",
"label": "Deleted Documents",
"link_count": 0,
"link_to": "Document Type Mapping",
"link_to": "Deleted Document",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
}
],
"modified": "2022-01-13 17:48:48.456763",
"modified": "2023-05-24 14:47:24.740856",
"modified_by": "Administrator",
"module": "Automation",
"name": "Tools",
"number_cards": [],
"owner": "Administrator",
"parent_page": "",
"public": 1,
"quick_lists": [],
"restrict_to_domain": "",
"roles": [],
"sequence_id": 26.0,
"sequence_id": 17.0,
"shortcuts": [
{
"label": "ToDo",
"link_to": "ToDo",
"color": "Grey",
"doc_view": "List",
"label": "Import Data",
"link_to": "Data Import",
"type": "DocType"
},
{
"label": "Note",
"link_to": "Note",
"label": "ToDo",
"link_to": "ToDo",
"type": "DocType"
},
{
Expand All @@ -238,11 +228,6 @@
"label": "Assignment Rule",
"link_to": "Assignment Rule",
"type": "DocType"
},
{
"label": "Auto Repeat",
"link_to": "Auto Repeat",
"type": "DocType"
}
],
"title": "Tools"
Expand Down
2 changes: 2 additions & 0 deletions frappe/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import frappe.defaults
import frappe.desk.desk_page
from frappe.core.doctype.navbar_settings.navbar_settings import get_app_logo, get_navbar_settings
from frappe.desk.doctype.form_tour.form_tour import get_onboarding_ui_tours
from frappe.desk.doctype.route_history.route_history import frequently_visited_links
from frappe.desk.form.load import get_meta_bundle
from frappe.email.inbox import get_email_accounts
Expand Down Expand Up @@ -68,6 +69,7 @@ def get_bootinfo():
bootinfo.home_folder = frappe.db.get_value("File", {"is_home_folder": 1})
bootinfo.navbar_settings = get_navbar_settings()
bootinfo.notification_settings = get_notification_settings()
bootinfo.onboarding_tours = get_onboarding_ui_tours()
set_time_zone(bootinfo)

# ipinfo
Expand Down
9 changes: 8 additions & 1 deletion frappe/core/doctype/server_script/server_script.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"script_type",
"reference_doctype",
"event_frequency",
"cron_format",
"doctype_event",
"api_method",
"allow_guest",
Expand Down Expand Up @@ -95,13 +96,19 @@
"fieldtype": "Select",
"label": "Event Frequency",
"mandatory_depends_on": "eval:doc.script_type == \"Scheduler Event\"",
"options": "All\nHourly\nDaily\nWeekly\nMonthly\nYearly\nHourly Long\nDaily Long\nWeekly Long\nMonthly Long"
"options": "All\nHourly\nDaily\nWeekly\nMonthly\nYearly\nHourly Long\nDaily Long\nWeekly Long\nMonthly Long\nCron"
},
{
"fieldname": "module",
"fieldtype": "Link",
"label": "Module (for export)",
"options": "Module Def"
},
{
"depends_on": "eval:doc.event_frequency==='Cron'",
"fieldname": "cron_format",
"fieldtype": "Data",
"label": "Cron Format"
}
],
"index_web_pages_for_search": 1,
Expand Down
15 changes: 11 additions & 4 deletions frappe/core/doctype/server_script/server_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,16 @@ def sync_scheduled_jobs(self):
def sync_scheduler_events(self):
"""Create or update Scheduled Job Type documents for Scheduler Event Server Scripts"""
if not self.disabled and self.event_frequency and self.script_type == "Scheduler Event":
setup_scheduler_events(script_name=self.name, frequency=self.event_frequency)
cron_format = self.cron_format if self.event_frequency == "Cron" else None
setup_scheduler_events(
script_name=self.name, frequency=self.event_frequency, cron_format=cron_format
)

def clear_scheduled_events(self):
"""Deletes existing scheduled jobs by Server Script if self.event_frequency has changed"""
if self.script_type == "Scheduler Event" and self.has_value_changed("event_frequency"):
"""Deletes existing scheduled jobs by Server Script if self.event_frequency or self.cron_format has changed"""
if self.script_type == "Scheduler Event" and (
self.has_value_changed("event_frequency") or self.has_value_changed("cron_format")
):
for scheduled_job in self.scheduled_jobs:
frappe.delete_doc("Scheduled Job Type", scheduled_job.name)

Expand Down Expand Up @@ -169,7 +174,7 @@ def get_keys(obj):
return items


def setup_scheduler_events(script_name, frequency):
def setup_scheduler_events(script_name: str, frequency: str, cron_format: str | None = None):
"""Creates or Updates Scheduled Job Type documents based on the specified script name and frequency
Args:
Expand All @@ -186,6 +191,7 @@ def setup_scheduler_events(script_name, frequency):
"method": method,
"frequency": frequency,
"server_script": script_name,
"cron_format": cron_format,
}
).insert()

Expand All @@ -198,6 +204,7 @@ def setup_scheduler_events(script_name, frequency):
return

doc.frequency = frequency
doc.cron_format = cron_format
doc.save()

frappe.msgprint(_("Scheduled execution for script {0} has updated").format(script_name))
Loading

0 comments on commit c16249a

Please sign in to comment.