From 7ded5a6fe79ed9c69fd9957605edd7d1cea22041 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 28 Sep 2012 16:04:53 +0530 Subject: [PATCH] fixes in profile, nestedset, wnf and grid report --- js/wn/views/doclistview.js | 11 ++++- js/wn/views/grid_report.js | 1 + py/core/doctype/profile/profile.py | 37 +++++++--------- py/core/doctype/profile/profile_list.js | 45 +++++++++++++++++++ py/webnotes/__init__.py | 11 +++++ py/webnotes/db.py | 59 ++++++++++++++++--------- py/webnotes/model/__init__.py | 9 ++++ py/webnotes/model/db_schema.py | 2 +- py/webnotes/model/doclist.py | 30 +++++-------- py/webnotes/profile.py | 1 + py/webnotes/utils/nestedset.py | 6 +-- wnf.py | 16 ++++++- 12 files changed, 163 insertions(+), 65 deletions(-) create mode 100644 py/core/doctype/profile/profile_list.js diff --git a/js/wn/views/doclistview.js b/js/wn/views/doclistview.js index 57d66a5437..cbf1b8818f 100644 --- a/js/wn/views/doclistview.js +++ b/js/wn/views/doclistview.js @@ -178,7 +178,7 @@ wn.views.DocListView = wn.ui.Listing.extend({ return this.listview.fields; }, get_args: function() { - return { + var args = { doctype: this.doctype, fields: this.get_query_fields(), filters: this.filter_list.get_filters(), @@ -187,6 +187,13 @@ wn.views.DocListView = wn.ui.Listing.extend({ order_by: this.listview.order_by || undefined, group_by: this.listview.group_by || undefined, } + + // apply default filters, if specified for a listing + $.each((this.listview.default_filters || []), function(i, f) { + args.filters.push(f); + }); + + return args; }, add_delete_option: function() { var me = this; @@ -550,9 +557,11 @@ wn.views.RecordListView = wn.views.DocListView.extend({ get_args: function() { var args = this._super(); + $.each((this.default_filters || []), function(i, f) { args.filters.push(f); }); + args.docstatus = args.docstatus.concat((this.default_docstatus || [])); return args; }, diff --git a/js/wn/views/grid_report.js b/js/wn/views/grid_report.js index 4a97f3462a..f5318d0b55 100644 --- a/js/wn/views/grid_report.js +++ b/js/wn/views/grid_report.js @@ -278,6 +278,7 @@ wn.views.GridReport = Class.extend({ }); }, make: function() { + var me = this; // plot wrapper this.plot_area = $('