[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:
Rushabh Mehta
2013-08-14 18:37:28 +05:30
parent ffe64db8f7
commit 62030e05cc
30 changed files with 686 additions and 656 deletions

View File

@@ -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();
});
}
});