* feat: added specific kanban board as quick link in workspace (#21721) (cherry picked from commit 986b6024241036e68cfa4103d015e46a4c433b7b) * fix: updated TYPE for workspace_shortcut * chore: linter fix --------- Co-authored-by: Vanessa Bualat <40702858+kkulloters@users.noreply.github.com> Co-authored-by: Shariq Ansari <30859809+shariquerik@users.noreply.github.com>
This commit is contained in:
parent
e31038d7f9
commit
1c5f5a38e9
5 changed files with 56 additions and 5 deletions
|
|
@ -9,6 +9,7 @@
|
|||
"link_to",
|
||||
"url",
|
||||
"doc_view",
|
||||
"kanban_board",
|
||||
"column_break_4",
|
||||
"label",
|
||||
"icon",
|
||||
|
|
@ -43,7 +44,7 @@
|
|||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "DocType View",
|
||||
"options": "\nList\nReport Builder\nDashboard\nTree\nNew\nCalendar"
|
||||
"options": "\nList\nReport Builder\nDashboard\nTree\nNew\nCalendar\nKanban"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_4",
|
||||
|
|
@ -103,12 +104,19 @@
|
|||
"in_list_view": 1,
|
||||
"label": "URL",
|
||||
"options": "URL"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.doc_view == \"Kanban\"",
|
||||
"fieldname": "kanban_board",
|
||||
"fieldtype": "Link",
|
||||
"label": "Kanban Board",
|
||||
"options": "Kanban Board"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-04-19 13:32:31.005443",
|
||||
"modified": "2023-07-18 16:12:53.546430",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Desk",
|
||||
"name": "Workspace Shortcut",
|
||||
|
|
@ -117,5 +125,6 @@
|
|||
"quick_entry": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": [],
|
||||
"track_changes": 1
|
||||
}
|
||||
|
|
@ -15,9 +15,12 @@ class WorkspaceShortcut(Document):
|
|||
from frappe.types import DF
|
||||
|
||||
color: DF.Color | None
|
||||
doc_view: DF.Literal["", "List", "Report Builder", "Dashboard", "Tree", "New", "Calendar"]
|
||||
doc_view: DF.Literal[
|
||||
"", "List", "Report Builder", "Dashboard", "Tree", "New", "Calendar", "Kanban"
|
||||
]
|
||||
format: DF.Data | None
|
||||
icon: DF.Data | None
|
||||
kanban_board: DF.Link | None
|
||||
label: DF.Data
|
||||
link_to: DF.DynamicLink | None
|
||||
parent: DF.Data
|
||||
|
|
|
|||
|
|
@ -1292,6 +1292,9 @@ Object.assign(frappe.utils, {
|
|||
break;
|
||||
case "Kanban":
|
||||
route = `${doctype_slug}/view/kanban`;
|
||||
if (item.kanban_board) {
|
||||
route += `/${item.kanban_board}`;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
route = doctype_slug;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ export default class ShortcutWidget extends Widget {
|
|||
stats_filter: this.stats_filter,
|
||||
type: this.type,
|
||||
url: this.url,
|
||||
kanban_board: this.kanban_board,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -35,6 +36,7 @@ export default class ShortcutWidget extends Widget {
|
|||
is_query_report: this.is_query_report,
|
||||
doctype: this.ref_doctype,
|
||||
doc_view: this.doc_view,
|
||||
kanban_board: this.kanban_board,
|
||||
});
|
||||
|
||||
let filters = frappe.utils.get_filter_from_json(this.stats_filter);
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ class ShortcutDialog extends WidgetDialog {
|
|||
onchange: () => {
|
||||
const doctype = this.dialog.get_value("link_to");
|
||||
if (doctype && this.dialog.get_value("type") == "DocType") {
|
||||
frappe.model.with_doctype(doctype, () => {
|
||||
frappe.model.with_doctype(doctype, async () => {
|
||||
let meta = frappe.get_meta(doctype);
|
||||
|
||||
if (doctype && frappe.boot.single_types.includes(doctype)) {
|
||||
|
|
@ -398,6 +398,13 @@ class ShortcutDialog extends WidgetDialog {
|
|||
if (meta.is_tree === "Tree") views.push("Tree");
|
||||
if (frappe.boot.calendars.includes(doctype)) views.push("Calendar");
|
||||
|
||||
const response = await frappe.db.get_value(
|
||||
"Kanban Board",
|
||||
{ reference_doctype: doctype },
|
||||
"name"
|
||||
);
|
||||
if (response?.message?.name) views.push("Kanban");
|
||||
|
||||
this.dialog.set_df_property("doc_view", "options", views.join("\n"));
|
||||
});
|
||||
} else {
|
||||
|
|
@ -429,11 +436,38 @@ class ShortcutDialog extends WidgetDialog {
|
|||
if (this.dialog) {
|
||||
let doctype = this.dialog.get_value("link_to");
|
||||
let is_single = frappe.boot.single_types.includes(doctype);
|
||||
return state.type == "DocType" && !is_single;
|
||||
return doctype && state.type == "DocType" && !is_single;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
onchange: () => {
|
||||
if (this.dialog.get_value("doc_view") == "Kanban") {
|
||||
this.dialog.fields_dict.kanban_board.get_query = () => {
|
||||
return {
|
||||
filters: {
|
||||
reference_doctype: this.dialog.get_value("link_to"),
|
||||
},
|
||||
};
|
||||
};
|
||||
} else {
|
||||
this.dialog.fields_dict.link_to.get_query = null;
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldtype: "Link",
|
||||
fieldname: "kanban_board",
|
||||
label: "Kanban Board",
|
||||
options: "Kanban Board",
|
||||
depends_on: () => {
|
||||
let doc_view = this.dialog?.get_value("doc_view");
|
||||
return doc_view == "Kanban";
|
||||
},
|
||||
mandatory_depends_on: () => {
|
||||
let doc_view = this.dialog?.get_value("doc_view");
|
||||
return doc_view == "Kanban";
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldtype: "Section Break",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue