fix: serial no scan not adding the serial nos in stock entry (#21083)

This commit is contained in:
rohitwaghchaure 2020-03-31 15:26:45 +05:30 committed by GitHub
parent ee0dec8776
commit 86aff0de1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 7 deletions

View File

@ -362,12 +362,17 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
['serial_no', 'batch_no', 'barcode'].forEach(field => {
if (data[field] && frappe.meta.has_field(row_to_modify.doctype, field)) {
let value = (row_to_modify[field] && field === "serial_no")
? row_to_modify[field] + '\n' + data[field] : data[field];
frappe.model.set_value(row_to_modify.doctype,
row_to_modify.name, field, data[field]);
row_to_modify.name, field, value);
}
});
scan_barcode_field.set_value('');
refresh_field("items");
});
}
return false;

View File

@ -310,14 +310,14 @@ frappe.ui.form.on('Stock Entry', {
method: "erpnext.stock.get_item_details.get_serial_no",
args: {"args": args},
callback: function(r) {
if (!r.exe){
if (!r.exe && r.message){
frappe.model.set_value(cdt, cdn, "serial_no", r.message);
}
if (callback) {
callback();
}
}
}
});
},
@ -623,12 +623,17 @@ frappe.ui.form.on('Stock Entry Detail', {
if(r.message) {
var d = locals[cdt][cdn];
$.each(r.message, function(k, v) {
if (v) {
frappe.model.set_value(cdt, cdn, k, v); // qty and it's subsequent fields weren't triggered
}
});
refresh_field("items");
if (!d.serial_no) {
erpnext.stock.select_batch_and_serial_no(frm, d);
}
}
}
});
}
},