Web Refresh From Backend
web_refresh_from_backend · OCA/web
-
Security25/25No findings
-
Activity20/25Last human commit 8 months ago
-
Required by5/250 modules depend on it
-
Maturity5/25In 1 Odoo series since 16.0
Heuristic over the facts below, not an audit · How it's computed
Description
Backend UI Reload Module
This is a technical module that allows triggering a UI reload from the backend. It enables triggering the reload action for selected users and record IDs.
NB: this module refreshes views using direct actions instead of calling action_reload.
This is done to avoid possible glitches and is aligned with the same approach used in the web_refreshed module.
🔧 Helper Function: reload_views
A special helper function reload_views is added to the res.users model.
Arguments
| Argument | Type | Description |
|---|---|---|
| model | Char | Model name, e.g. 'res.partner' |
| view_types | List of Char (optional) | View types to reload, e.g. ["form", "kanban"]. Leave blank to reload all views. |
| rec_ids | List of Integer (optional) | The view will be reloaded only if a record with an ID from this list is present in the view. |
⚠️ Important Notes
Use this function wisely.
When reloading form views, be aware that if a user is currently editing a record, their unsaved updates may be lost.
Dependencies
Code analysis
Extracted from the source by best-effort static analysis (no code is executed); details may be incomplete.
Views touched 0
No views found for this module.
HTTP endpoints 0
No HTTP endpoints found for this module.
Models touched 1
No new fields.
Public methods (1)-
reload_views(self, model, view_types=None, rec_ids=None)Trigger UI reload for selected users and record IDs. This method allows to reload specific views from the backend. Be aware that when reloading form views, if a user is currently doing some updates, those updates may be lost. :param model: str, Model name (e.g., 'res.partner') :param view_types: list of str, optional, View types to reload (e.g., ['form', 'kanban']). Leave blank to reload all views. :param rec_ids: list of int, optional, View will be reloaded only if a record with id from the list is present in the view. Example usage: # Reload the kanban and form views for all salespeople when an opportunity is won # Will reload views only if the current opportunity is being displayed group_id = self.env.ref("sales_team.group_sale_salesman").id users_to_reload = self.env["res.users"].search( [("groups_id", "in", [group_id])] ) users_to_reload.reload_views( model="crm.lead", view_types=["kanban", "form"], rec_ids=[self.id] )