[fix] [minor] show unsorted missing modules

This commit is contained in:
Rushabh Mehta 2016-01-15 14:10:20 +05:30
parent 6b68b405e2
commit 276c444edc
3 changed files with 22 additions and 15 deletions

View file

@ -645,7 +645,7 @@ def get_all_apps(with_frappe=False, with_internal_apps=True, sites_path=None):
apps.insert(0, 'frappe')
return apps
def get_installed_apps(sort=False):
def get_installed_apps(sort=False, frappe_last=False):
"""Get list of installed apps in current site."""
if getattr(flags, "in_install_db", True):
return []
@ -658,6 +658,11 @@ def get_installed_apps(sort=False):
if sort:
installed = [app for app in get_all_apps(True) if app in installed]
if frappe_last:
if 'frappe' in installed:
installed.remove('frappe')
installed.append('frappe')
return installed
def get_hooks(hook=None, default=None, app_name=None):

View file

@ -33,7 +33,7 @@ def get_bootinfo():
bootinfo.modules = {}
bootinfo.module_list = []
for app in frappe.get_installed_apps():
for app in frappe.get_installed_apps(frappe_last=True):
try:
modules = frappe.get_attr(app + ".config.desktop.get_data")() or {}
if isinstance(modules, dict):

View file

@ -104,26 +104,28 @@ $.extend(frappe.user, {
},
get_desktop_items: function(global) {
// get user sequence preference
var modules_list = null;
var modules_list = [];
if(!global) {
var user_list = frappe.defaults.get_default("_desktop_items");
if(user_list && user_list.length)
var modules_list = user_list;
if(modules_list) {
// add missing modules - they will be hidden anyways by the view
$.each(frappe.modules, function(m, module) {
var module = frappe.get_module(m);
if(modules_list.indexOf(m)===-1) {
modules_list.push(m);
}
});
}
}
if(!modules_list || !modules_list.length) {
// all modules
modules_list = frappe.boot.module_list;
frappe.boot.module_list.forEach(function(i, m) {
if(modules_list.indexOf(m)===-1) {
modules_list.push(m);
}
});
if(modules_list) {
// add missing modules - they will be hidden anyways by the view
$.each(frappe.modules, function(m, module) {
var module = frappe.get_module(m);
if(modules_list.indexOf(m)===-1) {
modules_list.push(m);
}
});
}
// filter hidden modules