function changed to add fetch
diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.js b/erpnext/buying/doctype/quality_inspection/quality_inspection.js
index 2e772c0..1f7134d 100644
--- a/erpnext/buying/doctype/quality_inspection/quality_inspection.js
+++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.js
@@ -58,17 +58,6 @@
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);
- }
- }
- });
-})
+cur_frm.add_fetch('item_code', 'item_name', 'item_name');
+cur_frm.add_fetch('item_code', 'description', 'description');
+
diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.py b/erpnext/buying/doctype/quality_inspection/quality_inspection.py
index 1b55c5b..d1d9518 100644
--- a/erpnext/buying/doctype/quality_inspection/quality_inspection.py
+++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.py
@@ -31,7 +31,6 @@
(self.name, self.modified, self.purchase_receipt_no,
self.item_code))
-
def on_cancel(self):
if self.purchase_receipt_no:
frappe.db.sql("""update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2
@@ -39,11 +38,6 @@
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"):
from frappe.desk.reportview import get_match_cond