diff --git a/addons/cx_web_refresh_from_backend/README.rst b/addons/cx_web_refresh_from_backend/README.rst new file mode 100644 index 0000000..6e10842 --- /dev/null +++ b/addons/cx_web_refresh_from_backend/README.rst @@ -0,0 +1,127 @@ +======================== +Web Refresh From Backend +======================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:e841ff66d3bfff0a3de22c9be5dc40f1ca539739f5487a9162fdf887fc5ac6ad + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-cetmix%2Fcetmix--tower-lightgray.png?logo=github + :target: https://github.com/cetmix/cetmix-tower/tree/16.0/cx_web_refresh_from_backend + :alt: cetmix/cetmix-tower + +|badge1| |badge2| |badge3| + +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. + +-------------- + +🔧 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`` | View types to reload, | +| | *(optional)* | e.g. | +| | | ``["form", "kanban"]``. | +| | | Leave blank to reload | +| | | all views. | ++----------------+--------------------------+--------------------------+ +| **rec_ids** | ``List of Integer`` | The view will be | +| | *(optional)* | 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** + +.. contents:: + :local: + +Usage +===== + +🧩 Example Usage +---------------- + +Below is a code snippet showing how to use the ``reload_views`` helper +function. + +.. code:: python + + # 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 part of the `cetmix/cetmix-tower `_ project on GitHub. + +You are welcome to contribute.