From da46a3782fdfabc1f3f410dad1f7c6aa37002d40 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 15 Jul 2013 17:52:10 +0530 Subject: [PATCH] [fix] [minor] get query --- buying/doctype/purchase_common/purchase_common.js | 2 ++ buying/doctype/purchase_common/purchase_common.py | 2 +- controllers/queries.py | 10 +++++++++- stock/doctype/material_request/material_request.txt | 4 ++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index bf2cbce91f..e93d34ed73 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -25,6 +25,7 @@ wn.require("app/js/transaction.js"); erpnext.buying.BuyingController = erpnext.TransactionController.extend({ onload: function() { this.setup_queries(); + this._super(); }, setup_queries: function() { @@ -39,6 +40,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ this.frm.set_query("price_list_currency", function() { return{ + query: "controllers.queries.get_price_list_currency", filters: { 'price_list_name': me.frm.doc.price_list_name, 'buying_or_selling': "Buying" diff --git a/buying/doctype/purchase_common/purchase_common.py b/buying/doctype/purchase_common/purchase_common.py index 1eb2809e36..e14b1caaae 100644 --- a/buying/doctype/purchase_common/purchase_common.py +++ b/buying/doctype/purchase_common/purchase_common.py @@ -221,4 +221,4 @@ class DocType(BuyingController): if d.prevdoc_doctype and d.prevdoc_docname: dt = sql("select transaction_date from `tab%s` where name = %s" % (d.prevdoc_doctype, '%s'), (d.prevdoc_docname)) - d.prevdoc_date = dt and dt[0][0].strftime('%Y-%m-%d') or '' + d.prevdoc_date = dt and dt[0][0].strftime('%Y-%m-%d') or '' \ No newline at end of file diff --git a/controllers/queries.py b/controllers/queries.py index ab2e234f18..d5f8dcb94f 100644 --- a/controllers/queries.py +++ b/controllers/queries.py @@ -217,4 +217,12 @@ def get_project_name(doctype, txt, searchfield, start, page_len, filters): and %(cond)s `tabProject`.name like "%(txt)s" %(mcond)s order by `tabProject`.name asc limit %(start)s, %(page_len)s """ % {'cond': cond,'txt': "%%%s%%" % txt, - 'mcond':get_match_cond(doctype, searchfield),'start': start, 'page_len': page_len}) \ No newline at end of file + 'mcond':get_match_cond(doctype, searchfield),'start': start, 'page_len': page_len}) + +def get_price_list_currency(doctype, txt, searchfield, start, page_len, filters): + return webnotes.conn.sql("""select ref_currency from `tabItem Price` + where price_list_name = %s and buying_or_selling = %s + and `%s` like %s order by ref_currency asc limit %s, %s""" % + ("%s", "%s", searchfield, "%s", "%s", "%s"), + (filters["price_list_name"], filters['buying_or_selling'], "%%%s%%" % txt, + start, page_len)) \ No newline at end of file diff --git a/stock/doctype/material_request/material_request.txt b/stock/doctype/material_request/material_request.txt index 92bca0ada9..f6dd6e64f0 100644 --- a/stock/doctype/material_request/material_request.txt +++ b/stock/doctype/material_request/material_request.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 14:48:38", "docstatus": 0, - "modified": "2013-07-09 11:39:32", + "modified": "2013-07-15 17:50:38", "modified_by": "Administrator", "owner": "Administrator" }, @@ -16,7 +16,7 @@ "module": "Stock", "name": "__common__", "read_only_onload": 1, - "search_fields": "status,transaction_date,sales_order_no" + "search_fields": "status,transaction_date" }, { "doctype": "DocField",