Merge branch 'develop' into stock-ageing-negative-stock
diff --git a/erpnext/projects/doctype/project/project.js b/erpnext/projects/doctype/project/project.js
index 31460f6..4f19bbd 100644
--- a/erpnext/projects/doctype/project/project.js
+++ b/erpnext/projects/doctype/project/project.js
@@ -59,22 +59,16 @@
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()) {
frm.add_custom_button(__('Duplicate Project with Tasks'), () => {
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.events.set_status(frm, 'Cancelled');
- }, __('Set Status'));
+ frm.trigger("set_project_status_button");
if (frappe.model.can_read("Task")) {
@@ -83,7 +77,7 @@
"project": frm.doc.name
};
frappe.set_route("List", "Task", "Gantt");
- });
+ }, __("View"));
frm.add_custom_button(__("Kanban Board"), () => {
frappe.call('erpnext.projects.doctype.project.project.create_kanban_board_if_not_exists', {
@@ -91,13 +85,35 @@
}).then(() => {
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) {
return new Promise(resolve => {
frappe.prompt('Project Name', (data) => {
@@ -117,7 +133,9 @@
set_status: function(frm, status) {
frappe.confirm(__('Set Project and all Tasks to status {0}?', [status.bold()]), () => {
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();
+ });
});
},