summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/chrome/menu.js
AgeCommit message (Collapse)Author
2021-04-28[FIX] web: web client boot when user has not apps availableXavier Morel
This mostly an issue when trying to run just the tests of `web` (aka `-iweb`) with only community modules available, `TestMenusDemoLight.test_01_click_apps_menus_as_demo`, wait for the ready code times out: AssertionError: False is not true : The ready "odoo.isReady === true" code was always falsy and the test suite fails. The ready code simply checks that `odoo.isReady` is set. The web client sets `isReady` when `webclient_started` is triggered (specifically in `_onWebClientStarted`, which is the handler for that event). [The community web client only triggers `webclient_started` at the end of `doAction`][0] meaning the community client is considered ready until after the first action has executed. [The first action is executed by `show_application`][1] whose process is the following: 1. load and initialize the menus 2. if an action is specified in the URL, run that 3. otherwise if the user has a home action, run that 4. otherwise run the first menu's action When installing only `web`, the only menus which could be available are Apps and Settings, and the demo user has access to neither. This means the demo user has no applications, and opening the first app is a no-op ([`openFirstApp` has a case just for that situation to ensure it does nothing][2]). As a result, `webclient_started` is never triggered, `_onWebClientStarted` is never called, `odoo.isReady` is never set, and the tour never runs. Fix by updating `openFirstApp` to return *whether* it opened an application, and in `show_application` the last fallback if even opening the first application failed is to just declare the web client ready. While at it, rewrite `show_application` using ES6 facilities and flatten and linearize it using guards. This means the code pretty much tracks the process described above, with one step added: 5. otherwise complete the webclient's startup [0]: https://github.com/odoo/odoo/blob/1eb474243b55f1b9e10c70d199bbe022e68b51d0/addons/web/static/src/js/chrome/action_manager.js#L174 [1]: https://github.com/odoo/odoo/blob/d1c56ec7c435c5baba8604feccc6116e4c25ca96/addons/web/static/src/js/chrome/web_client.js#L77-L107 [2]: https://github.com/odoo/odoo/blob/e24ab17d38fb049404f04112990e8b2fe1dd7727/addons/web/static/src/js/chrome/apps_menu.js#L44-L46 closes odoo/odoo#69962 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-09-17[FIX] web: handle concurrent actions at startupAaron Bohy
This commit aims at fixing a random bug on the runbot. When loading the webclient, if there is no hash, a rpc is done to read the default action of the user. When this rpc comes back, we execute the given action (if any), or the first action (typically Discuss). The navbar is displayed as soon as possible, it doesn't wait for the first action to be executed. This means that the user can open the user menu and click on 'My Profile' before the first action is executed. Before this commit, if the user clicked before the read rpc on 'res.users' returned, the default action (or the first) one, was executed, even though the user clicked on 'My Profile' and thus asked for a specific action. So basically, the user form view was briefly shown, and then replaced by the default or first action. Whereas this is a very rare usecase in practice (the timing is really short), this sometimes made the totp tour fail. However, even if it is unlikely, the client must be robust and correctly react to concurrent requests. This commit fixes the issue by executing the 'My Profile' action in the DropPrevious. That way, if any 'doAction' is performed, other pending operations (also done in DropPrevious) are dropped. This commit also ensures that the "brand name" part in the navbar (containing the name of the current app) is hidden when there is no current app, as in the scenario described above, we land in a webclient with no current app. Note that not being in an app was something that was already handled, but not at startup. closes odoo/odoo#57840 Related: odoo/enterprise#13277 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2020-03-03[FIX] web: Call on_attach_callback on systray widgetsLucas Lefèvre
Currently, the method `on_attach_callback` is never called on any Widget in the systray. Calling `on_attach_callback` is required if any systray widget uses an OWL component via the ComponentWrapper. Without the callback, the component is never considered mounted to the DOM and no event handler is triggered. closes odoo/odoo#46566 Related: odoo/enterprise#8887 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-02-28[FIX] web: fix more menujvm-odoo
Issue - Install Accounting - Resize your window to have the more menu - Refresh the page to make the JS working correctly - Click on the item on the left of the more menu - Do not close the menu just hover the more menu => It doesn't appears (the .show class is on the last <li> child instead of the parent) Click on the more menu => It appears but small & with items broken Cause Without the :first, all the more menu dropdown where toggled Issue Add :first to the target to toggle OPW-2178843 closes odoo/odoo#46553 X-original-commit: 55a4a834461446a070ad06d1b24d67fbc27799a1 Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com> Co-authored-by: aab-odoo <aab@odoo.com>
2019-05-28[IMP] web: Hovering out of a systray menu item closes its submenus dropdownPrakash Prajapati
While hovering in the systray a menu dropdown can only be open if user currently on his parent menu. It should close when user hover on another systray menu. Task: #1959678 closes odoo/odoo#32322 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-03-06[REF] web: adapt code after jQuery updateVincent Schippefilt
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2018-10-17[FIX] web: fix menu app button when menu_id can't be inferredDavid Monjoie
There used to be no processing done at all when loading the client from an url missing a menu_id and from which the menu could not be inferred from the action_id. This resulted in the app name button in the menu being empty but still present and not bound to any action. Clicking on it triggered a traceback. This commit stops ignoring the case when the menu cannot be inferred from the action and hides the entire menu and submenus for this particular action. They will be restored when entering an action from which a proper menu can be inferred. closes odoo/odoo#27791
2018-10-15[FIX] web: no duplication function for `change_menu_section`Alexandre Kühn
Revision on https://github.com/odoo/odoo/commit/b7cf456560dc4fd7c1217ba90f0b5609466ede50 The commit above assumed the function `change_menu_section` was mistakenly removed. However, it was turned into a handler function and renamed according to our JS guidelines `_onChangeMenuSection`. This commit removes the duplicated logic by removing the function `_onChangeMenuSection` and using `change_menu_section` as the handler for the bus event `change_menu_section`. closes odoo/odoo#27809
2018-10-10[FIX] web: `self.menu.change_menu_section` is not a functionAlexandre Kühn
Revision on https://github.com/odoo/odoo/commit/19eacf7d23c9413de4430a3422b5ed74b37ef242 The commit above changed the menu in community, so that it looks like enterprise. To do so, it copies the menu management from the enterprise repository to the community repository. Some code about the home menu has been removed, since it is replaced with the app menu in community. However, some functions have been removed by accident, such as `change_menu_section`. Closes #27436
2018-09-17[IMP] web: new navbar in communityAlexandre Kühn
The navbar in community now looks more like the navbar in enterprise. Here is a sum-up of the changes in community: - The navbar in community is now in blue, instead of black. - No more app list that almost fills the whole navbar: there is now an "Apps Menu" in the left-most side of the navbar. - No more sidebar for the menus inside an app: those menus are now located in the middle part of the navbar. The navbar in community does not support mobile (< 768px width), but it should still somewhat usable on most mobile devices. As for the website navbar, it has been unchanged and should still support mobile layout. Task-ID 1878649
2018-07-27[REF] web, *: share and adapt code for auto "more" buttons for navbarsqsm-odoo
* portal, web_tour, website, base Before this commit, there were 3 different implementations for the same feature: the "more" button in the community navbar, the "+" button for the website menu and the "+" button in the enterprise navbar. As those implementation were now broken with BS4, it was a good time to share the code of those 3 features.
2018-07-27[REF] web, *: BS4, adapt use of tooltip/popover.jsqsm-odoo
2018-03-20[MERGE] forward port branch 11.0 up to 2835d299792Christophe Simonis
2018-03-19[FIX] web: pick correct menu item on hashchangeAlexandre Kühn
Before this commit, we had the following issue: 1. install CRM and Sales 2. Sales > Customers > (open any form) 3. Click on browser's "back" button We are redirected to the contact kanban view in CRM instead of Sales. This is due to the fact that both menu items share the same action. When the user uses the browser's "back" button (AKA. it triggers an hashchange event), the web_client opens the first menu_item that matches the action. This commit fixes the issue by allowing us to open an action by providing a menu ID: 1. If it matches the action, then it opens this menu instead of the first match. 2. If we do not provide any menuID, or this menuID does not match with the action, it falls back to the first menu matching this action. Fixes #23639
2018-01-16[REF] web,*: ActionManager/ViewManager refactoringAaron Bohy
This rev. is the first part (out of 3) of the refactoring of the ActionManager and ViewManager layer of the webclient. The main changes are: - there is no ViewManager anymore, its work is now handled by the ActionManager itself, but isolated in a specific file ; this eases a lot of things, as the breadcrumbs handling for example. - the ActionManager code is converted to the new coding principles and guidelines ; mainly, children widgets communicate with it by triggering events up, and not by function calls anymore. - the ActionManager layer is now testable, and a lot of tests have already been written. - the code in other addons has been adapted consequently. What's coming next: - introduce the 'AbstractAction' Widget, and make client actions and view controllers inherit from it ; this widget will implement a common API that could be used uniformly by the ActionManager (e.g. restore(), canBeLeft(), renderButtons(), getTitle()...). - move the ControlPanel handling from the ActionManager to the AbstractAction.
2017-09-25[REF] web: preliminary work for the mobile Burger MenuAaron Bohy
2017-04-11[REF] web, *: redesign all JS viewsGéry Debongnie
This commit introduce a full redesign of all JS views. We started basically from scratch. The goal was to unify all the various views under a common framework, to make them testable, to make then usable in different conditions (in studio, or in the frontend), and to make our lives easier. Some important points are: - we introduced new coding guidelines (camelCase, 80 chars width, ...) - we have a brand new testing framework (still QUnit based) - kanban view moved to the web addon - calendar view (formerly web_calender) moved to web as well - the tree view was removed - all new code should be documented We hope that this code is the start of a new era for the Odoo web client, we want to have a high quality codebase, well documented, well tested, well designed. Work done by the framework team: mostly aab, ged, chm, dmo, qsm