More flexible close / reopen button for ToDo (#4433)

Make the close and reopen button for flexible for multiple status and custom status, like here:

https://github.com/frappe/erpnext/pull/11381
This commit is contained in:
ci2014 2017-11-10 07:54:20 +01:00 committed by Rushabh Mehta
parent 3c7683e6a1
commit 0ff005fcc5

View file

@ -18,7 +18,7 @@ frappe.ui.form.on("ToDo", {
}
if (!frm.doc.__islocal) {
if(frm.doc.status=="Open") {
if(frm.doc.status!=="Closed") {
frm.add_custom_button(__("Close"), function() {
frm.set_value("status", "Closed");
frm.save(null, function() {
@ -27,7 +27,7 @@ frappe.ui.form.on("ToDo", {
});
}, "fa fa-check", "btn-success");
} else {
frm.add_custom_button(__("Re-open"), function() {
frm.add_custom_button(__("Reopen"), function() {
frm.set_value("status", "Open");
frm.save();
}, null, "btn-default");