Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
319 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
srp 25
1398
1
čvc 25
2032
1
čvc 25
1123
1
čvn 25
12861
1
úno 22
4759