Skip to main content

Refresh views from backend

Project description

Odoo Community Association

Web Refresh From Backend

Beta License: LGPL-3 OCA/web Translate me on Weblate Try me on Runboat

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.

Table of contents

Usage

🧩 Example Usage

Below is a code snippet showing how to use the reload_views helper function.

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

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • Cetmix

Contributors

  • Cetmix

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

This module is part of the OCA/web project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file odoo_addon_web_refresh_from_backend-16.0.1.0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for odoo_addon_web_refresh_from_backend-16.0.1.0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 94da8858376d369aea115cc9e1b9018e855184176729f2dbefcd4bb1dc3e220f
MD5 82a63ef8f6eeca8028738cbfb7520498
BLAKE2b-256 ae74e23011aa3979c1a783d73fb72cc724400f67fe0d78ec85a40fd1e9b48e20

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page