fix(ux): hide new version btn on unsaved BOM (#31297)

This commit is contained in:
Ankush Menat 2022-06-09 15:33:18 +05:30 committed by GitHub
parent b29edb302c
commit d9a5213952
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,7 +81,7 @@ frappe.ui.form.on("BOM", {
}
)
if (!frm.doc.__islocal && frm.doc.docstatus<2) {
if (!frm.is_new() && frm.doc.docstatus<2) {
frm.add_custom_button(__("Update Cost"), function() {
frm.events.update_cost(frm, true);
});
@ -93,10 +93,12 @@ frappe.ui.form.on("BOM", {
});
}
frm.add_custom_button(__("New Version"), function() {
let new_bom = frappe.model.copy_doc(frm.doc);
frappe.set_route("Form", "BOM", new_bom.name);
});
if (!frm.is_new() && !frm.doc.docstatus == 0) {
frm.add_custom_button(__("New Version"), function() {
let new_bom = frappe.model.copy_doc(frm.doc);
frappe.set_route("Form", "BOM", new_bom.name);
});
}
if(frm.doc.docstatus==1) {
frm.add_custom_button(__("Work Order"), function() {