added index patch and updated general_ledger
This commit is contained in:
parent
4e8788a213
commit
69dc7bd3f5
5 changed files with 20 additions and 11 deletions
3
js/core.min.js
vendored
3
js/core.min.js
vendored
|
|
@ -270,7 +270,8 @@ return;}
|
|||
if(r.server_messages){r.server_messages=JSON.parse(r.server_messages)
|
||||
msgprint(r.server_messages);}
|
||||
if(r.exc){r.exc=JSON.parse(r.exc);if(r.exc instanceof Array){$.each(r.exc,function(i,v){if(v)console.log(v);})}else{console.log(r.exc);}};if(r['403']){wn.container.change_to('403');}
|
||||
if(r.docs){LocalDB.sync(r.docs);}}
|
||||
if(r.docs){LocalDB.sync(r.docs);}
|
||||
wn.last_response=r;}
|
||||
wn.request.call=function(opts){wn.request.prepare(opts);var ajax_args={url:opts.url||wn.request.url,data:opts.args,type:opts.type||'POST',dataType:opts.dataType||'json',success:function(r,xhr){wn.request.cleanup(opts,r);opts.success&&opts.success(r,xhr.responseText);},error:function(xhr,textStatus){wn.request.cleanup(opts,{});show_alert('Unable to complete request: '+textStatus)
|
||||
opts.error&&opts.error(xhr)}};if(opts.progress_bar){var interval=null;$.extend(ajax_args,{xhr:function(){var xhr=jQuery.ajaxSettings.xhr();interval=setInterval(function(){if(xhr.readyState>2){var total=parseInt(xhr.getResponseHeader('Original-Length')||0)||parseInt(xhr.getResponseHeader('Content-Length'));var completed=parseInt(xhr.responseText.length);var percent=(100.0/total*completed).toFixed(2);opts.progress_bar.css('width',(percent<10?10:percent)+'%');}},50);wn.last_xhr=xhr;return xhr;},complete:function(){opts.progress_bar.css('width','100%');clearInterval(interval);}})}
|
||||
$.ajax(ajax_args);}
|
||||
|
|
|
|||
|
|
@ -89,6 +89,8 @@ wn.request.cleanup = function(opts, r) {
|
|||
if(r.docs) {
|
||||
LocalDB.sync(r.docs);
|
||||
}
|
||||
|
||||
wn.last_response = r;
|
||||
}
|
||||
|
||||
wn.request.call = function(opts) {
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ wn.views.GridReport = Class.extend({
|
|||
editable: false,
|
||||
enableColumnReorder: false
|
||||
},
|
||||
dataview_filter: function(item) {
|
||||
apply_filters: function(item) {
|
||||
// generic filter: apply filter functiions
|
||||
// from all filter_inputs
|
||||
var filters = this.filter_inputs;
|
||||
|
|
|
|||
|
|
@ -363,7 +363,8 @@ def print_zip(response):
|
|||
response = compressBuf(response)
|
||||
eprint("Content-Encoding: gzip")
|
||||
eprint("Original-Length: %d" % orig_len)
|
||||
eprint("Content-Length: %d" % len(response))
|
||||
|
||||
eprint("Content-Length: %d" % len(response))
|
||||
|
||||
eprint("")
|
||||
print response
|
||||
|
|
@ -375,6 +376,8 @@ def json_handler(obj):
|
|||
# serialize date
|
||||
if isinstance(obj, datetime.date):
|
||||
return unicode(obj)
|
||||
if isinstance(obj, datetime.timedelta):
|
||||
return unicode(obj)
|
||||
else:
|
||||
raise TypeError, """Object of type %s with value of %s is not JSON serializable""" % \
|
||||
(type(obj), repr(obj))
|
||||
|
|
|
|||
|
|
@ -28,20 +28,26 @@ import json
|
|||
def get_data():
|
||||
from startup.report_data_map import data_map
|
||||
from webnotes.utils import cstr
|
||||
|
||||
import datetime
|
||||
doctypes = json.loads(webnotes.form_dict.get("doctypes"))
|
||||
out = {}
|
||||
|
||||
start = datetime.datetime.now()
|
||||
for d in doctypes:
|
||||
args = data_map[d]
|
||||
conditions = order_by = ""
|
||||
if args.get("force_index"):
|
||||
conditions = " force index (%s) " % args["force_index"]
|
||||
if args.get("conditions"):
|
||||
conditions = " where " + " and ".join(args["conditions"])
|
||||
conditions += " where " + " and ".join(args["conditions"])
|
||||
if args.get("order_by"):
|
||||
order_by = " order by " + args["order_by"]
|
||||
|
||||
out[d] = {}
|
||||
out[d]["data"] = webnotes.conn.sql("""select %s from `tab%s` %s %s""" % (",".join(args["columns"]),
|
||||
d, conditions, order_by), as_list=1)
|
||||
start = datetime.datetime.now()
|
||||
out[d]["data"] = [list(t) for t in webnotes.conn.sql("""select %s from `tab%s` %s %s""" % (",".join(args["columns"]),
|
||||
d, conditions, order_by), debug=True)]
|
||||
out[d]["time"] = str(datetime.datetime.now() - start)
|
||||
out[d]["columns"] = map(lambda c: c.split(" as ")[-1], args["columns"])
|
||||
|
||||
if args.get("links"):
|
||||
|
|
@ -66,8 +72,5 @@ def get_data():
|
|||
col_idx = out[d]["columns"].index(link_key)
|
||||
# replace by id
|
||||
row[col_idx] = link_map[row[col_idx]]
|
||||
|
||||
#for d in out:
|
||||
# out[d]["data"] = "~".join(["|".join([cstr(e) for e in p]) for p in out[d]["data"]])
|
||||
|
||||
|
||||
return out
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue