diff --git a/public/js/wn/views/grid_report.js b/public/js/wn/views/grid_report.js index 0f51c6bdaa..6dbdbcc820 100644 --- a/public/js/wn/views/grid_report.js +++ b/public/js/wn/views/grid_report.js @@ -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)); }); } }); diff --git a/webnotes/widgets/report_dump.py b/webnotes/widgets/report_dump.py index c0d4394643..68a941dfe3 100644 --- a/webnotes/widgets/report_dump.py +++ b/webnotes/widgets/report_dump.py @@ -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 = []