Skip to content

Commit

Permalink
fix: Show Report & Dashboard View for File Doctype (backport #17688) (#…
Browse files Browse the repository at this point in the history
…17695)

Co-authored-by: Shariq Ansari <30859809+shariquerik@users.noreply.github.com>
  • Loading branch information
mergify[bot] and shariquerik committed Aug 1, 2022
1 parent 59f58c7 commit ad09e87
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions frappe/public/js/frappe/list/list_factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ frappe.provide('frappe.views.list_view');

window.cur_list = null;
frappe.views.ListFactory = class ListFactory extends frappe.views.Factory {
make (route) {
make(route) {
var me = this;
var doctype = route[1];

Expand All @@ -14,8 +14,13 @@ frappe.views.ListFactory = class ListFactory extends frappe.views.Factory {
frappe.set_re_route('Form', doctype);
} else {
// List / Gantt / Kanban / etc
let view_name = frappe.utils.to_title_case(route[2] || 'List');

// File is a special view
const view_name = doctype !== 'File' ? frappe.utils.to_title_case(route[2] || 'List') : 'File';
if (doctype == "File" && !["Report", "Dashboard"].includes(view_name)) {
view_name = "File";
}

let view_class = frappe.views[view_name + 'View'];
if (!view_class) view_class = frappe.views.ListView;

Expand Down
5 changes: 4 additions & 1 deletion frappe/public/js/frappe/list/list_view_select.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ frappe.views.ListViewSelect = class ListViewSelect {
}

add_view_to_menu(view, action) {
if (this.doctype == "File" && view == "List") {
view = "File";
}
let $el = this.page.add_custom_menu_item(
this.parent,
__(view),
Expand Down Expand Up @@ -116,7 +119,7 @@ frappe.views.ListViewSelect = class ListViewSelect {
action: () => this.set_route("tree")
},
Kanban: {
condition: true,
condition: this.doctype != "File",
action: () => this.setup_kanban_boards(),
current_view_handler: () => {
frappe.views.KanbanView.get_kanbans(this.doctype).then(
Expand Down

0 comments on commit ad09e87

Please sign in to comment.