mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 19:29:10 +00:00
QA Inspection: get_query
This commit is contained in:
@@ -24,3 +24,21 @@ cur_frm.cscript.inspection_type = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.refresh = cur_frm.cscript.inspection_type;
|
cur_frm.cscript.refresh = cur_frm.cscript.inspection_type;
|
||||||
|
|
||||||
|
// item code based on GRN/DN
|
||||||
|
cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
|
||||||
|
if (doc.purchase_receipt_no)
|
||||||
|
return 'SELECT item_code, item_name, description FROM `tabPurchase Receipt Detail` WHERE parent = "'+ doc.purchase_receipt_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50';
|
||||||
|
else if (doc.delivery_note_no)
|
||||||
|
return 'SELECT item_code, item_name, description FROM `tabDelivery Note Detail` WHERE parent = "'+ doc.delivery_note_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50';
|
||||||
|
else
|
||||||
|
return 'SELECT name, item_name, description FROM tabItem WHERE docstatus != 2 AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Serial No based on item_code
|
||||||
|
cur_frm.fields_dict['item_serial_no'].get_query = function(doc, cdt, cdn) {
|
||||||
|
if (doc.item_code)
|
||||||
|
return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND item_code = "' + doc.item_code +'" AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||||
|
else
|
||||||
|
return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user