added code to fetch item name and desc on change of item code
diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.js b/erpnext/buying/doctype/quality_inspection/quality_inspection.js
index 3188c3c..2e772c0 100644
--- a/erpnext/buying/doctype/quality_inspection/quality_inspection.js
+++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.js
@@ -57,3 +57,18 @@
return { filters: filter }
}
+
+frappe.ui.form.on("Quality Inspection", "item_code", function(frm) {
+ frappe.call({
+ method: 'erpnext.buying.doctype.quality_inspection.quality_inspection.get_item_details',
+ args: {
+ "item_code": frm.doc.item_code
+ },
+ callback: function(r) {
+ if(!r.exc && r.message) {
+ frm.set_value("item_name", r.message.item_name);
+ frm.set_value("description", r.message.description);
+ }
+ }
+ });
+})
diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.json b/erpnext/buying/doctype/quality_inspection/quality_inspection.json
index e1b57e4..875ce0d 100644
--- a/erpnext/buying/doctype/quality_inspection/quality_inspection.json
+++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.json
@@ -128,6 +128,14 @@
"width": "50%"
},
{
+ "fieldname": "item_name",
+ "fieldtype": "Data",
+ "label": "Item Name",
+ "permlevel": 0,
+ "precision": "",
+ "read_only": 1
+ },
+ {
"fieldname": "description",
"fieldtype": "Small Text",
"in_filter": 1,
@@ -219,7 +227,7 @@
"icon": "icon-search",
"idx": 1,
"is_submittable": 1,
- "modified": "2015-04-14 07:37:07.331291",
+ "modified": "2015-06-08 02:40:25.121948",
"modified_by": "Administrator",
"module": "Buying",
"name": "Quality Inspection",
diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.py b/erpnext/buying/doctype/quality_inspection/quality_inspection.py
index ec32b6c..1b55c5b 100644
--- a/erpnext/buying/doctype/quality_inspection/quality_inspection.py
+++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.py
@@ -39,6 +39,10 @@
where t1.parent = %s and t1.item_code = %s and t1.parent = t2.name""",
(self.modified, self.purchase_receipt_no, self.item_code))
+@frappe.whitelist()
+def get_item_details(item_code):
+ item_details = frappe.db.sql("select item_name, description from tabItem where item_code=%s", item_code, as_dict=1)
+ return item_details[0] if item_details else {}
def item_query(doctype, txt, searchfield, start, page_len, filters):
if filters.get("from"):