Merge pull request #42980 from frappe/mergify/bp/version-14-hotfix/pr-42979
refactor: better UX on Bank Clearance tool (backport #42979)
This commit is contained in:
@@ -36,8 +36,12 @@ frappe.ui.form.on("Bank Clearance", {
|
|||||||
refresh: function (frm) {
|
refresh: function (frm) {
|
||||||
frm.disable_save();
|
frm.disable_save();
|
||||||
frm.add_custom_button(__("Get Payment Entries"), () => frm.trigger("get_payment_entries"));
|
frm.add_custom_button(__("Get Payment Entries"), () => frm.trigger("get_payment_entries"));
|
||||||
|
frm.change_custom_button_type(__("Get Payment Entries"), null, "primary");
|
||||||
frm.change_custom_button_type("Get Payment Entries", null, "primary");
|
if (frm.doc.payment_entries.length) {
|
||||||
|
frm.add_custom_button(__("Update Clearance Date"), () => frm.trigger("update_clearance_date"));
|
||||||
|
frm.change_custom_button_type(__("Get Payment Entries"), null, "default");
|
||||||
|
frm.change_custom_button_type(__("Update Clearance Date"), null, "primary");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
update_clearance_date: function (frm) {
|
update_clearance_date: function (frm) {
|
||||||
@@ -45,13 +49,7 @@ frappe.ui.form.on("Bank Clearance", {
|
|||||||
method: "update_clearance_date",
|
method: "update_clearance_date",
|
||||||
doc: frm.doc,
|
doc: frm.doc,
|
||||||
callback: function (r, rt) {
|
callback: function (r, rt) {
|
||||||
frm.refresh_field("payment_entries");
|
frm.refresh();
|
||||||
frm.refresh_fields();
|
|
||||||
|
|
||||||
if (!frm.doc.payment_entries.length) {
|
|
||||||
frm.change_custom_button_type("Get Payment Entries", null, "primary");
|
|
||||||
frm.change_custom_button_type("Update Clearance Date", null, "default");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -60,17 +58,8 @@ frappe.ui.form.on("Bank Clearance", {
|
|||||||
return frappe.call({
|
return frappe.call({
|
||||||
method: "get_payment_entries",
|
method: "get_payment_entries",
|
||||||
doc: frm.doc,
|
doc: frm.doc,
|
||||||
callback: function (r, rt) {
|
callback: function () {
|
||||||
frm.refresh_field("payment_entries");
|
frm.refresh();
|
||||||
|
|
||||||
if (frm.doc.payment_entries.length) {
|
|
||||||
frm.add_custom_button(__("Update Clearance Date"), () =>
|
|
||||||
frm.trigger("update_clearance_date")
|
|
||||||
);
|
|
||||||
|
|
||||||
frm.change_custom_button_type("Get Payment Entries", null, "default");
|
|
||||||
frm.change_custom_button_type("Update Clearance Date", null, "primary");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user