fix: guess module if not set in form tour

if unable to guess save in Desk module.
This commit is contained in:
Maharshi Patel 2023-05-25 11:42:24 +05:30
parent f612d84247
commit 32396c7fe5
2 changed files with 10 additions and 3 deletions

View file

@ -70,10 +70,10 @@
"label": "Is Standard"
},
{
"depends_on": "eval: doc.ui_tour && doc.is_standard",
"fetch_from": "reference_doctype.module",
"fieldname": "module",
"fieldtype": "Link",
"hidden": 1,
"label": "Module",
"options": "Module Def",
"read_only": 1
@ -104,7 +104,6 @@
"set_only_once": 1
},
{
"depends_on": "is_ui_tour",
"fieldname": "page_route",
"fieldtype": "Small Text",
"hidden": 1,
@ -179,7 +178,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-05-24 12:05:25.223405",
"modified": "2023-05-25 11:30:44.396248",
"modified_by": "Administrator",
"module": "Desk",
"name": "Form Tour",

View file

@ -8,6 +8,14 @@ from frappe.modules.export_file import export_to_files
class FormTour(Document):
def before_save(self):
if self.is_standard and not self.module:
if self.workspace_name:
self.module = frappe.db.get_value("Workspace", self.workspace_name, "module")
elif self.dashboard_name:
dashboard_doctype = frappe.db.get_value("Dashboard", self.dashboard_name, "module")
self.module = frappe.db.get_value("DocType", dashboard_doctype, "module")
else:
self.module = "Desk"
if not self.ui_tour:
meta = frappe.get_meta(self.reference_doctype)
for step in self.steps: