Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
332 Visualizzazioni

I'm having a hard time convincing the Finance team to "live with" the order of the Accounting Menus in Odoo.

The top level Menus - Dashboard, Customers, Vendors, Accounting, Reporting, Configuration - those aren't the ones they are concerned about.

It is the next level down, examples:

 

I am only asking because it has been brought up in three separate meetings as a "concern" so I'd rather just concede and placate the team rather than push back since there are other issues we need to be focusing on.  

We have spent more time than is sensible talking about it and when I mentioned it to the CEO, hoping he would see how ridiculous a request it was, he told me he could see their point and if it was an easy fix he thinks it should be changed.

I understand I can drag the Menu's around in in Developer Mode via Settings --> Technical --> User Interface --> Menu Items but there are a lot to work with and I understand I will also need to repeat this work after any upgrade.


Avatar
Abbandona
Risposta migliore

You can script this, the easiest way would be to create a Server Action based script (so you can run it directly).

accounting_menu = env["ir.ui.menu"].search([("name", "=", "Accounting"), ("parent_id", "=", False)])
top_level_menus = env["ir.ui.menu"].search([("parent_id", "=", accounting_menu.id)])
   
def sort_menus(menu):
    submenus = env["ir.ui.menu"].search([('name','!=',"Settings"),("parent_id", "=", menu.id)])
    if submenus:
        sorted_submenus = sorted(submenus, key=lambda m: m.name.lower())
        for index, submenu in enumerate(sorted_submenus, start=1):
            submenu['sequence'] = index * 10 
            sort_menus(submenu) 

for menu in top_level_menus:
    sort_menus(menu)


This excludes the SETTINGS Menu, so it still shows as the first sub menu under CONFIGURATION - so adjust the code if you want that included in the sort.


Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
ago 25
1398
1
lug 25
2041
1
lug 25
1123
1
giu 25
12864
1
feb 22
4763