Barcode added to stock entry

This commit is contained in:
Neil Trini Lasrado 2015-02-25 17:34:27 +05:30
parent e474aa5d91
commit 4abda67a98
3 changed files with 29 additions and 1 deletions

View File

@ -426,7 +426,21 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
}
});
}
}
cur_frm.cscript.barcode = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if (d.barcode) {
frappe.call({
method: "erpnext.stock.get_item_details.get_item_code",
args: {"barcode": d.barcode },
callback: function(r) {
if (!r.exe){
frappe.model.set_value(cdt, cdn, "item_code", r.message);
}
}
});
}
}
cur_frm.cscript.s_warehouse = function(doc, cdt, cdn) {

View File

@ -4,6 +4,19 @@
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"fieldname": "barcode",
"fieldtype": "Data",
"label": "Barcode",
"permlevel": 0,
"precision": ""
},
{
"fieldname": "section_break_2",
"fieldtype": "Section Break",
"permlevel": 0,
"precision": ""
},
{
"fieldname": "s_warehouse",
"fieldtype": "Link",
@ -331,7 +344,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2015-02-19 05:33:06.289852",
"modified": "2015-02-25 04:31:21.801200",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry Detail",

View File

@ -96,6 +96,7 @@ def process_args(args):
return args
@frappe.whitelist()
def get_item_code(barcode=None, serial_no=None):
if barcode:
item_code = frappe.db.get_value("Item", {"barcode": barcode})