@classmethod
    def menu_modules(cls):
        """ Custom Modules Menu """

        auth = current.auth

        if len(current.session.s3.roles) <= 2:
            # No specific Roles
            # Just show Profile on main menu
            return [MM("Profile", c="hrm", f="person",
                       args=[str(auth.s3_logged_in_person())],
                       vars={"profile":1},
                       ),
                    ]

        has_role = auth.s3_has_role
        #root_org = auth.root_org_name()
        system_roles = current.session.s3.system_roles
        ADMIN = system_roles.ADMIN
        ORG_ADMIN = system_roles.ORG_ADMIN

        s3db = current.s3db
        s3db.inv_recv_crud_strings()
        inv_recv_list = current.response.s3.crud_strings.inv_recv.title_list

        def hrm(item):
            return has_role(ORG_ADMIN) or \
                   has_role("training_coordinator") or \
                   has_role("training_assistant") or \
                   has_role("surge_manager") or \
                   has_role("disaster_manager")

        def inv(item):
            return has_role("wh_manager") or \
                   has_role("national_wh_manager") or \
                   has_role(ORG_ADMIN)

        def basic_warehouse(i):
            if not (has_role("national_wh_manager") or \
                    has_role(ORG_ADMIN)):
                # Hide menu entries which user shouldn't need access to
                return False
            else:
                return True

        def multi_warehouse(i):
            if not (has_role("national_wh_manager") or \
                    has_role(ORG_ADMIN)):
                # Only responsible for 1 warehouse so hide menu entries which should be accessed via Tabs on their warehouse
                return False
            else:
                return True

        menu= [#homepage("gis")(
               #),
               homepage("hrm", "org", name="Human Talent", check=hrm)(
                   MM("Human Talent", c="hrm", f="human_resource", m="summary"),
                   #MM("Teams", c="hrm", f="group"),
                   MM("National Societies", c="org", f="organisation",
                      vars = red_cross_filter),
                   #MM("Offices", c="org", f="office"),
                   MM("Positions", c="hrm", f="job_title"),
                   #MM("Training Events", c="hrm", f="training_event"),
                   #MM("Training Courses", c="hrm", f="course"),
               ),
               homepage("hrm", f="training_event", name="Training", check=hrm)(
                   MM("Training Centers", c="hrm", f="training_center"),
                   MM("Training Course Catalog", c="hrm", f="course"),
                   MM("Training Events", c="hrm", f="training_event"),
                   MM("External Trainees", c="pr", f="person"),
               ),
               homepage("inv", "supply", "req", check=inv)(
                   MM("Warehouses", c="inv", f="warehouse", m="summary", check=multi_warehouse),
                   MM(inv_recv_list, c="inv", f="recv", check=multi_warehouse),
                   MM("Sent Shipments", c="inv", f="send", check=multi_warehouse),
                   MM("Items", c="supply", f="item", check=basic_warehouse),
                   MM("Catalogs", c="supply", f="catalog", check=basic_warehouse),
                   #MM("Item Categories", c="supply", f="item_category"),
                   M("Suppliers", c="inv", f="supplier", check=basic_warehouse)(),
                   M("Facilities", c="inv", f="facility", check=basic_warehouse)(),
                   M("Requests", c="req", f="req")(),
                   #M("Commitments", f="commit")(),
               ),
               #homepage("asset")(
               #    MM("Assets", c="asset", f="asset", m="summary"),
               #    MM("Items", c="asset", f="item", m="summary"),
               #),
               homepage("project", f="project", m="summary")(
                   MM("Projects", c="project", f="project", m="summary"),
                   #MM("Locations", c="project", f="location"),
                   #MM("Outreach", c="po", f="index", check=outreach),
               ),
               ]

        # For some reason the deploy menu is displaying even if users have NONE access to deploy!
        # @ToDo: We will need to allow RIT members some basic access to the module
        if has_role("surge_manager") or has_role("disaster_manager"):
            menu.append(
                homepage("deploy", name="RIT", f="mission", m="summary",
                         vars={"~.status__belongs": "2"})(
                    MM("Missions", c="deploy", f="mission", m="summary"),
                    MM("Members", c="deploy", f="human_resource", m="summary"),
                ))

        return menu

    # -------------------------------------------------------------------------
dataset/ETHPy150Open sahana/eden/modules/templates/RMSAmericas/menus.py/S3MainMenu.menu_modules/original