ODOO通知记录数据是否已过时

发布于 2025-02-03 06:42:46 字数 1940 浏览 4 评论 0原文

当Odoo 15发行时,我已经看到此记录并不是最新的(不确定实际单词),

问题是我已获得记录的批准,但是如果夏季获得批准记录的用户仍然在页面上批准后不要看到记录的更新。我确实发送了通知,但是用户希望该页面刷新或显示记录视图不是最新的(Odoo在发布的第一周在做什么)

对不起,没有代码,但不确定如何去关于这样做。 不期望解决您的事情的想法,也许您有时间您的想法可能会失败(缺点)。

        /**
         * Displays one notification on user's screen when assets have changed
         */
        function displayBundleChangedNotification() {
            if (!isNotificationDisplayed) {
                // Wrap the notification inside a delay.
                // The server may be overwhelmed with recomputing assets
                // We wait until things settle down
                browser.clearTimeout(bundleNotifTimerID);
                bundleNotifTimerID = browser.setTimeout(() => {
                    notification.add(
                        env._t("The page appears to be out of date."),
                        {
                            title: env._t("Refresh"),
                            type: "warning",
                            sticky: true,
                            buttons: [
                                {
                                    name: env._t("Refresh"),
                                    primary: true,
                                    onClick: () => {
                                        browser.location.reload();
                                    },
                                },
                            ],
                            onClose: () => {
                                isNotificationDisplayed = false;
                            },
                        }
                    );
                    isNotificationDisplayed = true;
                }, getBundleNotificationDelay());
            }
        }

addons/bus/static/src/js/services/assets_watchdog_service.js

this也许是我需要的东西,但是资产

这里的主要问题是如何知道用户是否在修改后的记录上并运行函数

when odoo 15 was released I have seen this record is not up to date (not sure of the actual words)

The issue is that I have a approval for a record but if the user that summered the record for approval is still on the page he don't see the updates to the record after the approval. I do send the notification but the user wants the page to refresh or show that the record view is not up to date like (what odoo was doing in the first week of the released)

sorry is there is no code but am not sure how go about doing this.
Not expecting a solution just ideas on what you thing and maybe in you have time why your idea may fail (drawbacks).

        /**
         * Displays one notification on user's screen when assets have changed
         */
        function displayBundleChangedNotification() {
            if (!isNotificationDisplayed) {
                // Wrap the notification inside a delay.
                // The server may be overwhelmed with recomputing assets
                // We wait until things settle down
                browser.clearTimeout(bundleNotifTimerID);
                bundleNotifTimerID = browser.setTimeout(() => {
                    notification.add(
                        env._t("The page appears to be out of date."),
                        {
                            title: env._t("Refresh"),
                            type: "warning",
                            sticky: true,
                            buttons: [
                                {
                                    name: env._t("Refresh"),
                                    primary: true,
                                    onClick: () => {
                                        browser.location.reload();
                                    },
                                },
                            ],
                            onClose: () => {
                                isNotificationDisplayed = false;
                            },
                        }
                    );
                    isNotificationDisplayed = true;
                }, getBundleNotificationDelay());
            }
        }

addons/bus/static/src/js/services/assets_watchdog_service.js

this maybe semlar to what I need but assets

The main question here Is how to know if a user is on the modified record and run a function

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

皓月长歌 2025-02-10 06:42:46
  1. 设置Web插座,该网络插座聆听已确定的更新事件
    通过ID和提示通知
    通知与该点的页面上的文档ID匹配
    时间。
  2. 每x秒对与页面上的文档相对应的记录进行一次轮询,并比较一些独特的值,这些价值会像最后一次更改。如果更改了及时的通知和刷新。
  3. 保留开放页面的元数据列表。可以使用心跳间隔和Onload Onunload事件使列表有效。每当两个或多个文档同时打开时,请在页面上知道“正在编辑文档,目前无法编辑的文档将相应地更新”或类似的内容。
  4. 使用服务工作者和推动API将更新发送到主运行应用程序
  1. setup a web socket that listens for update events identified
    by ID’s and prompt notifications if the documentId of the
    notification matches the ID of document on page at that point in
    time.
  2. Poll every x seconds for the record corresponding to document on page and compare some unique value that would have changed like lastUpdated. If changed prompt notification and refresh.
  3. Keep a metadata list of open pages. Can use heartbeat interval and onLoad onUnload events to keep list valid. Whenever two or more documents are open at the same time make it known on page that “document is being edited and cannot be currently edited will update accordingly” or something like that.
  4. Use service workers and the push api to send updates to the main running app
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文