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

This commit is contained in:
Rushabh Mehta 2013-01-25 10:19:35 +05:30
commit 1cdc0ca855
2 changed files with 13 additions and 8 deletions

View file

@ -580,6 +580,7 @@ wn.views.GridReport = Class.extend({
return date==v.year_start_date ? true : null;
}).length;
});
}
// set label as last date of period
@ -715,11 +716,13 @@ wn.views.TreeGridReport = wn.views.GridReportWithPlot.extend({
if(!tmap[v.parent]) tmap[v.parent] = [];
tmap[v.parent].push(v);
});
this.tl = [];
if (!this.tl) this.tl = {};
if (!this.tl[parent_doctype]) this.tl[parent_doctype] = [];
$.each(wn.report_dump.data[parent_doctype], function(i, parent) {
if(tmap[parent.name]) {
$.each(tmap[parent.name], function(i, d) {
me.tl.push($.extend(copy_dict(parent), d));
me.tl[parent_doctype].push($.extend(copy_dict(parent), d));
});
}
});

View file

@ -34,6 +34,8 @@ def get_data():
start = datetime.datetime.now()
for d in doctypes:
args = data_map[d]
dt = d.find("[") != -1 and d[:d.find("[")] or d
conditions = order_by = ""
if args.get("force_index"):
conditions = " force index (%s) " % args["force_index"]
@ -41,17 +43,17 @@ def get_data():
conditions += " where " + " and ".join(args["conditions"])
if args.get("order_by"):
order_by = " order by " + args["order_by"]
table = args.get("from") or ("`tab%s`" % d)
table = args.get("from") or ("`tab%s`" % dt)
out[d] = {}
out[dt] = {}
start = datetime.datetime.now()
out[d]["data"] = [list(t) for t in webnotes.conn.sql("""select %s from %s %s %s""" \
out[dt]["data"] = [list(t) for t in webnotes.conn.sql("""select %s from %s %s %s""" \
% (",".join(args["columns"]), table, conditions, order_by))]
out[d]["time"] = str(datetime.datetime.now() - start)
out[d]["columns"] = map(lambda c: c.split(" as ")[-1], args["columns"])
out[dt]["time"] = str(datetime.datetime.now() - start)
out[dt]["columns"] = map(lambda c: c.split(" as ")[-1], args["columns"])
if args.get("links"):
out[d]["links"] = args["links"]
out[dt]["links"] = args["links"]
for d in out:
unused_links = []