[minor] quality inspection
This commit is contained in:
parent
dd266fafc3
commit
865e62df61
@ -1,11 +1,6 @@
|
|||||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
|
||||||
if (doc.item_code)
|
|
||||||
return 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 = '';
|
||||||
@ -30,13 +25,22 @@ cur_frm.cscript.refresh = cur_frm.cscript.inspection_type;
|
|||||||
|
|
||||||
// item code based on GRN/DN
|
// item code based on GRN/DN
|
||||||
cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
|
||||||
var filter = {};
|
if (doc.purchase_receipt_no) {
|
||||||
if (doc.purchase_receipt_no) filter['parent'] = doc.purchase_receipt_no;
|
|
||||||
|
|
||||||
else if (doc.delivery_note_no) filter['parent'] = doc.delivery_note_no;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
filters: filter
|
query: "buying.doctype.quality_inspection.quality_inspection.item_query",
|
||||||
|
filters: {
|
||||||
|
"from": "Purchase Receipt Item",
|
||||||
|
"parent": doc.purchase_receipt_no
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (doc.delivery_note_no) {
|
||||||
|
return {
|
||||||
|
query: "buying.doctype.quality_inspection.quality_inspection.item_query",
|
||||||
|
filters: {
|
||||||
|
"from": "Delivery Note Item",
|
||||||
|
"parent": doc.delivery_note_no
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,3 +33,17 @@ class DocType:
|
|||||||
webnotes.conn.sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '', t2.modified = '%s' \
|
webnotes.conn.sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '', t2.modified = '%s' \
|
||||||
where t1.parent = '%s' and t1.item_code = '%s' and t1.parent = t2.name" \
|
where t1.parent = '%s' and t1.item_code = '%s' and t1.parent = t2.name" \
|
||||||
% (self.doc.modified, self.doc.purchase_receipt_no, self.doc.item_code))
|
% (self.doc.modified, self.doc.purchase_receipt_no, self.doc.item_code))
|
||||||
|
|
||||||
|
|
||||||
|
def item_query(doctype, txt, searchfield, start, page_len, filters):
|
||||||
|
if filters.get("from"):
|
||||||
|
from webnotes.widgets.reportview import get_match_cond
|
||||||
|
filters.update({
|
||||||
|
"txt": txt,
|
||||||
|
"mcond": get_match_cond(filters["from"], searchfield),
|
||||||
|
"start": start,
|
||||||
|
"page_len": page_len
|
||||||
|
})
|
||||||
|
return webnotes.conn.sql("""select item_code from `tab%(from)s`
|
||||||
|
where parent='%(parent)s' and docstatus < 2 and item_code like '%%%(txt)s%%' %(mcond)s
|
||||||
|
order by item_code limit %(start)s, %(page_len)s""" % filters)
|
Loading…
x
Reference in New Issue
Block a user