Skip to content

[19.0][ADD] web_action_binding_refresh - #3655

Closed
moylop260 wants to merge 1 commit into
OCA:19.0from
moylop260:19.0-add-web_action_binding_refresh
Closed

[19.0][ADD] web_action_binding_refresh#3655
moylop260 wants to merge 1 commit into
OCA:19.0from
moylop260:19.0-add-web_action_binding_refresh

Conversation

@moylop260

@moylop260 moylop260 commented Sep 4, 2026

Copy link
Copy Markdown

New module: Web Action Binding Refresh.

Creating a contextual action does not make it appear in the Actions menu of the
model it is bound to, and reloading does not obviously fix it either.

Cause

The view toolbar is built server side from the action bindings and travels inside
get_views. Since 19.0 the web client serves that response from a cache persisted in
IndexedDB (view_service.js#L98-L102) and invalidates it
for ir.ui.view and ir.filters only (#L47-L54).
ir.actions.server is not in that list, and the Create / Remove Contextual Action
buttons call create_action / unlink_action through call_button, so they are not
in UPDATE_METHODS either. Binding an action therefore never invalidates
get_views.

In 18.0 the same cache was a plain in-memory object rebuilt on every page load, so a
refresh hid the missing invalidation. That is why this only surfaces now.

What the module does

It adds the listener core does not register, for the four action models. It patches
nothing: rpcBus is exported by @web/core/network/rpc and CLEAR-CACHES is
already consumed there at rpc.js#L85-L87, which calls
RPCCache.invalidate and clears both the IndexedDB
and the RAM cache. The module only publishes the event core does not publish for
action models, so it survives an upstream version bump untouched.

Why not in core

Proposed as odoo/odoo#286419 and declined — the maintainer's answer:

"You have to reload the webclient to see the action appear. We were aware of that
and believe that it is fine. Creating a server action is an advanced and quite rare
flow, so we prefer the current situation than make the code more complex."

A legitimate call for core. This module is for the installations that would rather
not reload.

Status

The server side is measured: get_bindings and get_views(toolbar=True) both return
a newly bound action immediately, so the stale data is entirely client side.

The listener itself has not been exercised in a browser yet — flagging that
honestly rather than claiming a test I have not run.

Closed since that I'm not able to reproduce it anymore

Creating a contextual action does not make it appear in the Actions menu
of the model it is bound to.

The toolbar of a view is built server side from the action bindings and
travels inside the get_views response, which the web client caches in
IndexedDB since 19.0.  Core invalidates that cache on writes to
ir.ui.view and ir.filters only, so binding an action leaves the cached
entry in place.  In 18.0 the cache was a plain in-memory object rebuilt
on every page load, which hid the missing invalidation behind a refresh.

Odoo was asked to add the invalidation in core in odoo/odoo#286419 and
declined, answering that reloading the webclient is the expected
behaviour and that creating a server action is too rare a flow to carry
the extra code:
odoo/odoo#286419 (comment)

The module publishes the CLEAR-CACHES event that rpc.js already consumes,
so it patches nothing in core.
@OCA-git-bot OCA-git-bot added series:19.0 mod:web_action_binding_refresh Module web_action_binding_refresh labels Sep 4, 2026
@moylop260 moylop260 closed this Sep 4, 2026
@moylop260
moylop260 deleted the 19.0-add-web_action_binding_refresh branch September 4, 2026 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:web_action_binding_refresh Module web_action_binding_refresh series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants