Merge pull request #5902 from akshay83/develop

[fix] serial no button
This commit is contained in:
Rushabh Mehta 2016-07-28 15:05:04 +05:30 committed by GitHub
commit 142b6187b3

View File

@ -33,13 +33,13 @@ $.extend(erpnext, {
setup_serial_no: function() { setup_serial_no: function() {
var grid_row = cur_frm.open_grid_row(); var grid_row = cur_frm.open_grid_row();
if(!grid_row || !grid_row.fields_dict.serial_no || if(!grid_row || !grid_row.grid_form.fields_dict.serial_no ||
grid_row.fields_dict.serial_no.get_status()!=="Write") return; grid_row.grid_form.fields_dict.serial_no.get_status()!=="Write") return;
var $btn = $('<button class="btn btn-sm btn-default">'+__("Add Serial No")+'</button>') var $btn = $('<button class="btn btn-sm btn-default">'+__("Add Serial No")+'</button>')
.appendTo($("<div>") .appendTo($("<div>")
.css({"margin-bottom": "10px", "margin-top": "10px"}) .css({"margin-bottom": "10px", "margin-top": "10px"})
.appendTo(grid_row.fields_dict.serial_no.$wrapper)); .appendTo(grid_row.grid_form.fields_dict.serial_no.$wrapper));
$btn.on("click", function() { $btn.on("click", function() {
var d = new frappe.ui.Dialog({ var d = new frappe.ui.Dialog({
@ -69,7 +69,7 @@ $.extend(erpnext, {
var serial_no = d.get_value("serial_no"); var serial_no = d.get_value("serial_no");
if(serial_no) { if(serial_no) {
var val = (grid_row.doc.serial_no || "").split("\n").concat([serial_no]).join("\n"); 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()); grid_row.grid_form.fields_dict.serial_no.set_model_value(val.trim());
} }
d.hide(); d.hide();
return false; return false;
@ -190,4 +190,4 @@ $(document).on('app_ready', function() {
}); });
}); });
} }
}); });