function changed to add fetch

This commit is contained in:
Neil Trini Lasrado 2015-06-08 13:09:11 +05:30
parent 9dbdef3bd5
commit 42c1836db5
2 changed files with 3 additions and 20 deletions

View File

@ -58,17 +58,6 @@ cur_frm.fields_dict['item_serial_no'].get_query = function(doc, cdt, cdn) {
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');

View File

@ -31,7 +31,6 @@ class QualityInspection(Document):
(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 @@ class QualityInspection(Document):
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