Browse Source

[fix] [minor] get query

develop
Nabin Hait 11 years ago
parent
commit
da46a3782f
  1. 2
      buying/doctype/purchase_common/purchase_common.js
  2. 2
      buying/doctype/purchase_common/purchase_common.py
  3. 10
      controllers/queries.py
  4. 4
      stock/doctype/material_request/material_request.txt

2
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"

2
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 ''

10
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})
'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))

4
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",

Loading…
Cancel
Save