mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
[Serial No] Major updates, code cleanup, "In Store" is now "Available". Serial No can only be created via Stock Entry / Purchase Receipt. Serial No can be auto created using Series if mentioned in Item master
This commit is contained in:
@@ -36,4 +36,46 @@ $.extend(erpnext, {
|
||||
territory.territory = wn.defaults.get_default("territory");
|
||||
}
|
||||
},
|
||||
|
||||
setup_serial_no: function(grid_row) {
|
||||
if(grid_row.fields_dict.serial_no.get_status()!=="Write") return;
|
||||
|
||||
var $btn = $('<button class="btn btn-sm btn-default">Add Serial No</button>')
|
||||
.appendTo($("<div>")
|
||||
.css({"margin-bottom": "10px"})
|
||||
.appendTo(grid_row.fields_dict.serial_no.$wrapper));
|
||||
|
||||
$btn.on("click", function() {
|
||||
var d = new wn.ui.Dialog({
|
||||
title: "Add Serial No",
|
||||
fields: [
|
||||
{
|
||||
"fieldtype": "Link",
|
||||
"options": "Serial No",
|
||||
"label": "Serial No",
|
||||
"get_query": {
|
||||
item_code: grid_row.doc.item_code,
|
||||
warehouse: grid_row.doc.warehouse
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldtype": "Button",
|
||||
"label": "Add"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
d.get_input("add").on("click", function() {
|
||||
var serial_no = d.get_value("serial_no");
|
||||
if(serial_no) {
|
||||
var val = (grid_row.doc.serial_no || "").split("\n").concat([serial_no]).join("\n");
|
||||
grid_row.fields_dict.serial_no.set_model_value(val.trim());
|
||||
}
|
||||
d.hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
d.show();
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user