|
@ -59,22 +59,16 @@ frappe.ui.form.on("Project", { |
|
|
|
|
|
|
|
|
frm.trigger('show_dashboard'); |
|
|
frm.trigger('show_dashboard'); |
|
|
} |
|
|
} |
|
|
frm.events.set_buttons(frm); |
|
|
frm.trigger("set_custom_buttons"); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
set_buttons: function(frm) { |
|
|
set_custom_buttons: function(frm) { |
|
|
if (!frm.is_new()) { |
|
|
if (!frm.is_new()) { |
|
|
frm.add_custom_button(__('Duplicate Project with Tasks'), () => { |
|
|
frm.add_custom_button(__('Duplicate Project with Tasks'), () => { |
|
|
frm.events.create_duplicate(frm); |
|
|
frm.events.create_duplicate(frm); |
|
|
}); |
|
|
}, __("Actions")); |
|
|
|
|
|
|
|
|
frm.add_custom_button(__('Completed'), () => { |
|
|
|
|
|
frm.events.set_status(frm, 'Completed'); |
|
|
|
|
|
}, __('Set Status')); |
|
|
|
|
|
|
|
|
|
|
|
frm.add_custom_button(__('Cancelled'), () => { |
|
|
frm.trigger("set_project_status_button"); |
|
|
frm.events.set_status(frm, 'Cancelled'); |
|
|
|
|
|
}, __('Set Status')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (frappe.model.can_read("Task")) { |
|
|
if (frappe.model.can_read("Task")) { |
|
@ -83,7 +77,7 @@ frappe.ui.form.on("Project", { |
|
|
"project": frm.doc.name |
|
|
"project": frm.doc.name |
|
|
}; |
|
|
}; |
|
|
frappe.set_route("List", "Task", "Gantt"); |
|
|
frappe.set_route("List", "Task", "Gantt"); |
|
|
}); |
|
|
}, __("View")); |
|
|
|
|
|
|
|
|
frm.add_custom_button(__("Kanban Board"), () => { |
|
|
frm.add_custom_button(__("Kanban Board"), () => { |
|
|
frappe.call('erpnext.projects.doctype.project.project.create_kanban_board_if_not_exists', { |
|
|
frappe.call('erpnext.projects.doctype.project.project.create_kanban_board_if_not_exists', { |
|
@ -91,13 +85,35 @@ frappe.ui.form.on("Project", { |
|
|
}).then(() => { |
|
|
}).then(() => { |
|
|
frappe.set_route('List', 'Task', 'Kanban', frm.doc.project_name); |
|
|
frappe.set_route('List', 'Task', 'Kanban', frm.doc.project_name); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}, __("View")); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
set_project_status_button: function(frm) { |
|
|
|
|
|
frm.add_custom_button(__('Set Project Status'), () => { |
|
|
|
|
|
let d = new frappe.ui.Dialog({ |
|
|
|
|
|
"title": __("Set Project Status"), |
|
|
|
|
|
"fields": [ |
|
|
|
|
|
{ |
|
|
|
|
|
"fieldname": "status", |
|
|
|
|
|
"fieldtype": "Select", |
|
|
|
|
|
"label": "Status", |
|
|
|
|
|
"reqd": 1, |
|
|
|
|
|
"options": "Completed\nCancelled", |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
primary_action: function() { |
|
|
|
|
|
frm.events.set_status(frm, d.get_values().status); |
|
|
|
|
|
d.hide(); |
|
|
|
|
|
}, |
|
|
|
|
|
primary_action_label: __("Set Project Status") |
|
|
|
|
|
}).show(); |
|
|
|
|
|
}, __("Actions")); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
create_duplicate: function(frm) { |
|
|
create_duplicate: function(frm) { |
|
|
return new Promise(resolve => { |
|
|
return new Promise(resolve => { |
|
|
frappe.prompt('Project Name', (data) => { |
|
|
frappe.prompt('Project Name', (data) => { |
|
@ -117,7 +133,9 @@ frappe.ui.form.on("Project", { |
|
|
set_status: function(frm, status) { |
|
|
set_status: function(frm, status) { |
|
|
frappe.confirm(__('Set Project and all Tasks to status {0}?', [status.bold()]), () => { |
|
|
frappe.confirm(__('Set Project and all Tasks to status {0}?', [status.bold()]), () => { |
|
|
frappe.xcall('erpnext.projects.doctype.project.project.set_project_status', |
|
|
frappe.xcall('erpnext.projects.doctype.project.project.set_project_status', |
|
|
{project: frm.doc.name, status: status}).then(() => { /* page will auto reload */ }); |
|
|
{project: frm.doc.name, status: status}).then(() => { |
|
|
|
|
|
frm.reload_doc(); |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|