diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 716b4a837b..7a5add6cb0 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -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) { diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json index 750e7d68eb..fb654c20db 100644 --- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json +++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json @@ -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", diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 52cb5ac3db..4d03106edb 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -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})