mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-19 14:55:13 +00:00
fix(ux): hide new version btn on unsaved BOM (#31297)
(cherry picked from commit d9a5213952)
Co-authored-by: Ankush Menat <me@ankush.dev>
This commit is contained in:
@@ -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.add_custom_button(__("Update Cost"), function() {
|
||||||
frm.events.update_cost(frm, true);
|
frm.events.update_cost(frm, true);
|
||||||
});
|
});
|
||||||
@@ -93,10 +93,12 @@ frappe.ui.form.on("BOM", {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
frm.add_custom_button(__("New Version"), function() {
|
if (!frm.is_new() && !frm.doc.docstatus == 0) {
|
||||||
let new_bom = frappe.model.copy_doc(frm.doc);
|
frm.add_custom_button(__("New Version"), function() {
|
||||||
frappe.set_route("Form", "BOM", new_bom.name);
|
let new_bom = frappe.model.copy_doc(frm.doc);
|
||||||
});
|
frappe.set_route("Form", "BOM", new_bom.name);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if(frm.doc.docstatus==1) {
|
if(frm.doc.docstatus==1) {
|
||||||
frm.add_custom_button(__("Work Order"), function() {
|
frm.add_custom_button(__("Work Order"), function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user