Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Priya 2013-09-24 12:48:50 +05:30
commit a5b5bfcab0
2 changed files with 30 additions and 12 deletions

View File

@ -1,11 +1,6 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
// 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) {
if(doc.inspection_type == 'Incoming'){
doc.delivery_note_no = '';
@ -30,13 +25,22 @@ 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) {
var filter = {};
if (doc.purchase_receipt_no) filter['parent'] = doc.purchase_receipt_no;
else if (doc.delivery_note_no) filter['parent'] = doc.delivery_note_no;
return{
filters: filter
if (doc.purchase_receipt_no) {
return {
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
}
}
}
}

View File

@ -33,3 +33,17 @@ class DocType:
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" \
% (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)