fix: issues in flows to create desktop icon in forms
This commit is contained in:
parent
3c2b8e762e
commit
3dacf6a3b1
2 changed files with 18 additions and 6 deletions
|
|
@ -3,14 +3,16 @@
|
|||
|
||||
frappe.ui.form.on("Desktop Icon", {
|
||||
refresh: function (frm) {
|
||||
if (frm.doc.link_to && frm.doc.type) {
|
||||
if (frm.doc.link_to && frm.doc.link_type) {
|
||||
frm.add_custom_button(
|
||||
__("Workspace Sidebar"),
|
||||
function () {
|
||||
frappe.new_doc("Workspace Sidebar", {}, (doc) => {
|
||||
doc.title = frm.doc.label;
|
||||
doc.header_icon = frm.doc.icon;
|
||||
let sidebar_item = frappe.model.add_child(doc, "items");
|
||||
sidebar_item.label = frm.doc.link_to;
|
||||
sidebar_item.link_to = frm.doc.link_to;
|
||||
sidebar_item.link_type = frm.doc.link_type;
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
// Copyright (c) 2025, Frappe Technologies and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("Workspace Sidebar", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
||||
frappe.ui.form.on("Workspace Sidebar", {
|
||||
refresh(frm) {
|
||||
if (!frm.is_new()) {
|
||||
frm.add_custom_button(__(`View Sidebar`), () => {
|
||||
if (frm.doc.items[0].link_type === "DocType") {
|
||||
frappe.set_route("List", frm.doc.items[0].link_to);
|
||||
return;
|
||||
} else if (frm.doc.items[0].link_type === "Workspace") {
|
||||
frappe.set_route("Workspaces", frm.doc.items[0].link_to);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue