Repository
OCA/web · module folder · Try on Runboat
Module version
1.0.0
Category
Web
Folder size
0.06 MB
License
LGPL-3
Application
No
Auto-installable
No
Website
https://github.com/OCA/web
Last tracking update
2026-08-07 08:09:11
Authors
Odoo Community Association (OCA), Cetmix
Maintainers
Odoo Community Association (OCA), Cetmix
Committers
Weblate, OCA-git-bot, oca-ci, Ivan Sokolov
Odoo dependencies
odoo/odoo:
- web
- bus
Python dependencies
None
System dependencies
None
Required by
None
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](https://github.com/OCA/web/tree/16.0/web_refresher) 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**.

Code Analysis

Views touched (0)

No views found for this module.

HTTP endpoints (0)

No HTTP endpoints found for this module.

Models touched (1)

New fields (0)

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] )