diff --git a/erpnext/startup/js/modules.js b/erpnext/startup/js/modules.js index 2e0e701197b..2799fa13003 100644 --- a/erpnext/startup/js/modules.js +++ b/erpnext/startup/js/modules.js @@ -61,22 +61,40 @@ erpnext.module_page.hide_links = function(wrapper) { erpnext.module_page.make_list = function(module, wrapper) { // make project listing - wrapper.list = new wn.ui.Listing({ - parent: $(wrapper).find('.reports-list').get(0), - method: 'utilities.get_report_list', + var $w = $(wrapper).find('.reports-list'); + var $parent1 = $('
').appendTo($w); + var $parent2 = $('').appendTo($w); + + wrapper.list1 = new wn.ui.Listing({ + parent: $parent1, + method: 'utilities.get_sc_list', render_row: function(row, data) { if(!data.parent_doc_type) data.parent_doc_type = data.doc_type; $(row).html(repl('\ %(criteria_name)s', data)) }, - args: { - module: module - }, + args: { module: module }, no_refresh: true, callback: function(r) { - erpnext.module_page.hide_links(wrapper) + erpnext.module_page.hide_links($parent1) } }); - wrapper.list.run(); + wrapper.list1.run(); + + wrapper.list2 = new wn.ui.Listing({ + parent: $parent2, + method: 'utilities.get_report_list', + render_row: function(row, data) { + $(row).html(repl('\ + %(name)s', data)) + }, + args: { module: module }, + no_refresh: true, + callback: function(r) { + erpnext.module_page.hide_links($parent2) + } + }); + wrapper.list2.run(); } \ No newline at end of file diff --git a/erpnext/utilities/__init__.py b/erpnext/utilities/__init__.py index d57f0def058..f6f38596ff7 100644 --- a/erpnext/utilities/__init__.py +++ b/erpnext/utilities/__init__.py @@ -17,7 +17,7 @@ import webnotes @webnotes.whitelist() -def get_report_list(arg=None): +def get_sc_list(arg=None): """return list of reports for the given module module""" webnotes.response['values'] = webnotes.conn.sql("""select distinct criteria_name, doc_type, parent_doc_type @@ -26,4 +26,16 @@ def get_report_list(arg=None): and docstatus in (0, NULL) and ifnull(disabled, 0) = 0 order by criteria_name + limit %(limit_start)s, %(limit_page_length)s""" % webnotes.form_dict, as_dict=True) + +@webnotes.whitelist() +def get_report_list(): + """return list on new style reports for modules""" + webnotes.response['values'] = webnotes.conn.sql("""select + distinct tabReport.name, tabReport.ref_doctype + from `tabReport`, `tabDocType` + where tabDocType.module='%(module)s' + and tabDocType.name = tabReport.ref_doctype + and tabReport.docstatus in (0, NULL) + order by tabReport.name limit %(limit_start)s, %(limit_page_length)s""" % webnotes.form_dict, as_dict=True) \ No newline at end of file diff --git a/public/js/all-app.js b/public/js/all-app.js index 3d2b40a53f0..ced6b2523ed 100644 --- a/public/js/all-app.js +++ b/public/js/all-app.js @@ -2284,9 +2284,11 @@ erpnext.hide_naming_series=function(){if(cur_frm.fields_dict.naming_series){hide */ wn.provide('erpnext.module_page');erpnext.module_page.setup_page=function(module,wrapper){erpnext.module_page.hide_links(wrapper);erpnext.module_page.make_list(module,wrapper);$(wrapper).find("a[title]").tooltip({delay:{show:500,hide:100}});} erpnext.module_page.hide_links=function(wrapper){$(wrapper).find('[href*="List/"]').each(function(){var href=$(this).attr('href');var dt=href.split('/')[1];if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});$(wrapper).find('[data-doctype]').each(function(){var dt=$(this).attr('data-doctype');if(wn.boot.profile.all_read.indexOf(dt)==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});$(wrapper).find('[href*="Form/"]').each(function(){var href=$(this).attr('href');var dt=href.split('/')[1];if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});} -erpnext.module_page.make_list=function(module,wrapper){wrapper.list=new wn.ui.Listing({parent:$(wrapper).find('.reports-list').get(0),method:'utilities.get_report_list',render_row:function(row,data){if(!data.parent_doc_type)data.parent_doc_type=data.doc_type;$(row).html(repl('').appendTo($w);var $parent2=$('').appendTo($w);wrapper.list1=new wn.ui.Listing({parent:$parent1,method:'utilities.get_sc_list',render_row:function(row,data){if(!data.parent_doc_type)data.parent_doc_type=data.doc_type;$(row).html(repl('\ - %(criteria_name)s',data))},args:{module:module},no_refresh:true,callback:function(r){erpnext.module_page.hide_links(wrapper)}});wrapper.list.run();} + %(criteria_name)s',data))},args:{module:module},no_refresh:true,callback:function(r){erpnext.module_page.hide_links($parent1)}});wrapper.list1.run();wrapper.list2=new wn.ui.Listing({parent:$parent2,method:'utilities.get_report_list',render_row:function(row,data){$(row).html(repl('\ + %(name)s',data))},args:{module:module},no_refresh:true,callback:function(r){erpnext.module_page.hide_links($parent2)}});wrapper.list2.run();} /* * erpnext/startup/js/toolbar.js */