From e33f827e32d1c076a5ee76a922f32d68fa687818 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 10 Apr 2013 19:33:57 +0530 Subject: [PATCH] [modules] [fix] patch for storing only hidden modules --- patches/april_2013/p04_reverse_modules_list.py | 5 +++-- patches/april_2013/p05_fixes_in_reverse_modules.py | 10 ++++++++++ patches/patch_list.py | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 patches/april_2013/p05_fixes_in_reverse_modules.py diff --git a/patches/april_2013/p04_reverse_modules_list.py b/patches/april_2013/p04_reverse_modules_list.py index 9215fea5d9..1751d36ca2 100644 --- a/patches/april_2013/p04_reverse_modules_list.py +++ b/patches/april_2013/p04_reverse_modules_list.py @@ -6,6 +6,7 @@ def execute(): ml = json.loads(webnotes.conn.get_global("modules_list") or "[]") - webnotes.conn.set_global("hidden_modules", - json.dumps(list(set(modules.keys()).difference(set(ml))))) + if ml: + webnotes.conn.set_global("hidden_modules", + json.dumps(list(set(modules.keys()).difference(set(ml))))) \ No newline at end of file diff --git a/patches/april_2013/p05_fixes_in_reverse_modules.py b/patches/april_2013/p05_fixes_in_reverse_modules.py new file mode 100644 index 0000000000..8f5b2f773e --- /dev/null +++ b/patches/april_2013/p05_fixes_in_reverse_modules.py @@ -0,0 +1,10 @@ +import webnotes, json +import webnotes.utils + +def execute(): + modules = webnotes.get_config().modules + + ml = json.loads(webnotes.conn.get_global("hidden_modules")) + + if len(ml) == len(modules.keys()): + webnotes.conn.set_global("hidden_modules", json.dumps([])) \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index ca80d94e61..be7e5cb3b9 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -241,4 +241,5 @@ patch_list = [ "patches.april_2013.p04_reverse_modules_list", "execute:webnotes.delete_doc('Search Criteria', 'time_log_summary')", "patches.april_2013.p04_update_role_in_pages", + "patches.april_2013.p05_fixes_in_reverse_modules", ] \ No newline at end of file