Repository: ynput/OpenPype
Issue: Maya doesn't load OpenPype workfiles tool

In maya we are accidentally loading default avalon workfiles tool, which is causing troubles in certain situations.

Specifically when trying to create a new file on a task that doesn't yet have work area created, we get nothing with this traceback.

```
# Traceback (most recent call last):
#   File "C:\\Users\\milan\\code\\openpype\\repos\\avalon-core\\avalon\\tools\\workfiles\\app.py", line 613, in on_save_as_pressed
#     self.initialize_work_directory()
#   File "C:\\Users\\milan\\code\\openpype\\repos\\avalon-core\\avalon\\tools\\workfiles\\app.py", line 652, in initialize_work_directory
#     app_definition = pipeline.lib.get_application(app_name)
#   File "C:\\Users\\milan\\code\\openpype\\repos\\avalon-core\\avalon\\lib.py", line 160, in get_application
#     "No application definition could be found for '%s'" % name
# ValueError: No application definition could be found for 'maya/2020'
```

Changed files:
openpype/hosts/maya/api/menu.py

diff --git a/openpype/hosts/maya/api/menu.py b/openpype/hosts/maya/api/menu.py
index 0dced48868..ad225dcd28 100644
--- a/openpype/hosts/maya/api/menu.py
+++ b/openpype/hosts/maya/api/menu.py
@@ -16,12 +16,9 @@ log = logging.getLogger(__name__)
 
 def _get_menu(menu_name=None):
     """Return the menu instance if it currently exists in Maya"""
-
-    project_settings = get_project_settings(os.getenv("AVALON_PROJECT"))
-    _menu = project_settings["maya"]["scriptsmenu"]["name"]
-
     if menu_name is None:
-        menu_name = _menu
+        menu_name = pipeline._menu
+
     widgets = dict((
         w.objectName(), w) for w in QtWidgets.QApplication.allWidgets())
     menu = widgets.get(menu_name)
@@ -58,11 +55,64 @@ def deferred():
                 parent=pipeline._parent
             )
 
+        # Find the pipeline menu
+        top_menu = _get_menu()
+
+        # Try to find workfile tool action in the menu
+        workfile_action = None
+        for action in top_menu.actions():
+            if action.text() == "Work Files":
+                workfile_action = action
+                break
+
+        # Add at the top of menu if "Work Files" action was not found
+        after_action = ""
+        if workfile_action:
+            # Use action's object name for `insertAfter` argument
+            after_action = workfile_action.objectName()
+
+        # Insert action to menu
+        cmds.menuItem(
+            "Work Files",
+            parent=pipeline._menu,
+            command=launch_workfiles_app,
+            insertAfter=after_action
+        )
+
+        # Remove replaced action
+        if workfile_action:
+            top_menu.removeAction(workfile_action)
+
+    def remove_project_manager():
+        top_menu = _get_menu()
+
+        # Try to find "System" menu action in the menu
+        system_menu = None
+        for action in top_menu.actions():
+            if action.text() == "System":
+                system_menu = action
+                break
+
+        if system_menu is None:
+            return
+
+        # Try to find "Project manager" action in "System" menu
+        project_manager_action = None
+        for action in system_menu.menu().children():
+            if hasattr(action, "text") and action.text() == "Project Manager":
+                project_manager_action = action
+                break
+
+        # Remove "Project manager" action if was found
+        if project_manager_action is not None:
+            system_menu.menu().removeAction(project_manager_action)
+
     log.info("Attempting to install scripts menu ...")
 
     add_build_workfiles_item()
     add_look_assigner_item()
     modify_workfiles()
+    remove_project_manager()
 
     try:
         import scriptsmenu.launchformaya as launchformaya
@@ -110,7 +160,6 @@ def install():
         log.info("Skipping openpype.menu initialization in batch mode..")
         return
 
-    uninstall()
     # Allow time for uninstallation to finish.
     cmds.evalDeferred(deferred)