mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
QA Inspection: get_query
This commit is contained in:
@@ -1,26 +1,44 @@
|
|||||||
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
||||||
if (doc.item_code)
|
if (doc.item_code)
|
||||||
get_server_fields('get_purchase_receipt_item_details','','',doc,cdt,cdn,1);
|
get_server_fields('get_purchase_receipt_item_details','','',doc,cdt,cdn,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.inspection_type = function(doc, cdt, cdn) {
|
cur_frm.cscript.inspection_type = function(doc, cdt, cdn) {
|
||||||
if(doc.inspection_type == 'Incoming'){
|
if(doc.inspection_type == 'Incoming'){
|
||||||
doc.delivery_note_no = '';
|
doc.delivery_note_no = '';
|
||||||
hide_field('delivery_note_no');
|
hide_field('delivery_note_no');
|
||||||
unhide_field('purchase_receipt_no');
|
unhide_field('purchase_receipt_no');
|
||||||
}
|
}
|
||||||
else if(doc.inspection_type == 'Outgoing'){
|
else if(doc.inspection_type == 'Outgoing'){
|
||||||
doc.purchase_receipt_no = '';
|
doc.purchase_receipt_no = '';
|
||||||
unhide_field('delivery_note_no');
|
unhide_field('delivery_note_no');
|
||||||
hide_field('purchase_receipt_no');
|
hide_field('purchase_receipt_no');
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
doc.purchase_receipt_no = '';
|
doc.purchase_receipt_no = '';
|
||||||
doc.delivery_note_no = '';
|
doc.delivery_note_no = '';
|
||||||
hide_field('purchase_receipt_no');
|
hide_field('purchase_receipt_no');
|
||||||
hide_field('delivery_note_no');
|
hide_field('delivery_note_no');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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