How to hide unnecessary menu from sidebar in main page of custom app

Hi all,
I want to hide the unnecessary menu from sidebar in main page of custom app.please help me to fix this.
Thanks

Hi @vivin_joseph,

you can go to Setup > Show/Hide Modules (/desk#modules_setup) and deactivate unneccessary modules (select for Everyone):

Also, the modules do not show up if a user does not have the corresponding access rights…

Hope this helps.

@lasalesi but its hiding only desktop icons. I need to hide the unecessary menu in the side bar . below picture with red marked portion

In some cases, such as agriculture, this works, but you are right, it does not allow to disable all. Have you checked the Domain Settings
grafik

And as mentioned, as a last resort, consider controlling it through the access permissions (remove unneccessary roles on the user). If a user has no access to any function within Accounts, this will remove the entry…

@vivin_joseph

you cannot hidden the sidebar if u give minim 1 permission to doctype inside the menu…
i forcely remove the sidebar by change the code and css

like this

@Rico_Nova In which css file and code edited.

@vivin_joseph

i made change in here

/home/frappe/frappe-bench/apps/frappe/frappe/desk/page/modules/modules.js

i add this code

page.wrapper.find(’.layout-side-section’).removeClass(‘col-md-2’);
page.wrapper.find(’.layout-main-section-wrapper’).removeClass(‘col-md-10’);
page.wrapper.find(’.layout-main-section-wrapper’).addClass(‘col-md-12’);

thats work on version

erpnext 9.2.21
frappe 9.2.22

when i try again at newer version

erpnext 10.1.33
frappe 10.1.31

thats not work anymore and then i change this css and less

apps/frappe/frappe/public/css/sidebar.css
apps/frappe/frappe/public/less/sidebar.less

.layout-side-section .module-sidebar-nav

i add
display : none;

and thats work for me at newer version

you can go to file
/home/frappe/frappe-bench/sites/assets/css/desk.min.css
and in this class

.layout-side-section {
  font-size: 12px;
  padding-right: 0px;
}

add
display:none;

@Rico_Nova It works for me.But i don’t want to remove the whole sidebar.
i need to show the custom modules.

@vivin_joseph

hmm… after i make some test, i wanna ask 1st about the other module that not to be shown…
is the user also can open the menu inside that module?

example :

my user can open Sales Order but cannot open Selling Module

if u have the condition like that, then we cannot hide the module from sidebar
else u can use this 1 :

at erpnext 8.8.4 frappe 8.7.9
/home/frappe/frappe-bench/apps/frappe/frappe/desk/page/modules/modules_sidebar_item.html

u can make combination with if
like this i just want to show Accounts Module

    <li class="strong module-sidebar-item">
    	{% if item.module_name == "Accounts" %}
        <a class="module-link" data-name="{{ item.module_name }}"
					href="#modules/{{ item.module_name }}">
          <i class="fa fa-chevron-right pull-right"
						style="display: none;"></i>
          <span>{{ item._label }}</span></a>
          {% endif %}
    </li>

and this is the result

but if u open other menu inside other module, pop up error will appear
this example when i try open Stock Module

for newer version
at this 1
/home/frappe/frappe-bench/apps/frappe/frappe/desk/page/modules/modules_section.html

@Rico_Nova is the user also can open the menu inside that module?
Yes . The user need to open.We need to show related module in sidebar.

Hi Everyone,

Thank you for this thread. After much experimentation, I’m happy to say that I’ve found a solution to this.

Here is it:

Version Number : v11.x.x-develop
Files to edit: /home/frappe/frappe-bench/apps/frappe/frappe/desk/page/modules/modules.js

Code to edit FROM:

page.get_page_modules = () => {
		return frappe.get_desktop_icons(true)          
			.filter(d => d.type==='module' && !d.blocked)
			.sort((a, b) => { return (a._label > b._label) ? 1 : -1; })
			
            	
};

Code to edit TO:

page.get_page_modules = () => {
		return frappe.get_desktop_icons(true)          
			.filter(d => d.type==='module' && !d.blocked && d.module_name!=='Learn') //Modification
			.sort((a, b) => { return (a._label > b._label) ? 1 : -1; })
			
            	
};

This will essentially disable the “LEARN” button from the sidebar completely.

And Here’s how you remove the “HELP” section entirely from each of the pages:
Code to edit FROM:

return frappe.call({
				method: "frappe.desk.moduleview.get",
				args: {
					module: module_name
				},
				callback: function(r) {
					var m = frappe.get_module(module_name);					
					m.data = r.message.data;				
					process_data(module_name, m.data);
					page.section_data[module_name] = m;					
					render_section(m);
				},
				freeze: true,
});

Code to edit TO:

return frappe.call({
				method: "frappe.desk.moduleview.get",
				args: {
					module: module_name
				},
				callback: function(r) {
					var m = frappe.get_module(module_name);					
					m.data = r.message.data.filter(d=>d.label!=='Help'); //Modification
					process_data(module_name, m.data);
					page.section_data[module_name] = m;					
					render_section(m);
				},
				freeze: true,
});
11 Likes

How do we do this from the custom app ?

1 Like