Skip to content

[17.0][ADD] web_action_desktop_only: hide desktop-only menus on small screens#3502

Open
sersanchus wants to merge 1 commit intoOCA:17.0from
heligrafics:17.0-add-web-action-desktop-only
Open

[17.0][ADD] web_action_desktop_only: hide desktop-only menus on small screens#3502
sersanchus wants to merge 1 commit intoOCA:17.0from
heligrafics:17.0-add-web-action-desktop-only

Conversation

@sersanchus
Copy link
Copy Markdown

@sersanchus sersanchus commented Apr 2, 2026

Summary

This PR introduces the new module web_action_desktop_only.

It allows administrators to mark specific actions as desktop only, so their associated menu entries are automatically hidden on small-screen (mobile) devices.
No Python logic is needed at runtime on mobile: the filtering happens entirely on the frontend via a patch to the menu service.

It also introduces a main action flag that designates the primary entry point of an application. When some child menus are hidden on mobile, the app automatically redirects to the first child marked as main action.

Both flags are added to the base ir.actions.actions model, so they apply to any action type (ir.actions.act_window, ir.actions.client, ir.actions.report, etc.).

Typical use case: An ERP module has sub-menus for a real-time map (desktop only), a complex dashboard (desktop only), and a summary list (available everywhere). On mobile, only the summary list is shown and becomes
the app's landing page. On desktop, all menus work normally.

Note: If an app has children and all of them are marked as desktop_only with no main_action sibling, the entire app entry is hidden on mobile rather than showing a broken landing page.

How it works

  • Two boolean fields (desktop_only, main_action) are added to ir.actions.actions.
  • ir.ui.menu.load_web_menus is extended to include DesktopOnly and MainAction properties in the menu payload, loaded once at startup with no extra RPC calls at runtime.
  • The JavaScript patch replaces getApps() in the menu service to filter apps and re-assign entry points on small screens.
  • A form view extension on ir.actions.act_window and ir.actions.client exposes the two fields in the UI under the Visibility tab, so they can be toggled from the web interface without touching XML.

@sersanchus sersanchus force-pushed the 17.0-add-web-action-desktop-only branch 4 times, most recently from 7b936e1 to 56f6d41 Compare April 2, 2026 07:46
@sersanchus sersanchus force-pushed the 17.0-add-web-action-desktop-only branch from 56f6d41 to e4502e0 Compare April 2, 2026 08:10
@sersanchus sersanchus marked this pull request as ready for review April 2, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants