mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-12 14:11:46 +00:00
feat: confirmation dialog when enabling negative stock on Item
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -54,6 +54,28 @@ frappe.ui.form.on("Item", {
|
||||
}
|
||||
},
|
||||
|
||||
allow_negative_stock(frm) {
|
||||
if (!frm.doc.allow_negative_stock) {
|
||||
return;
|
||||
}
|
||||
|
||||
let msg = __(
|
||||
"Using negative stock disables FIFO/Moving average valuation when inventory is negative."
|
||||
);
|
||||
msg += " ";
|
||||
msg += __("This is considered dangerous from accounting point of view.");
|
||||
msg += "<br>";
|
||||
msg += __("Do you still want to enable negative inventory?");
|
||||
|
||||
frappe.confirm(
|
||||
msg,
|
||||
() => {},
|
||||
() => {
|
||||
frm.set_value("allow_negative_stock", 0);
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
setup: function (frm) {
|
||||
frm.add_fetch("attribute", "numeric_values", "numeric_values");
|
||||
frm.add_fetch("attribute", "from_range", "from_range");
|
||||
|
||||
Reference in New Issue
Block a user