From 17bb1d228febe9aadfa2b0f02b71f6e936b0b134 Mon Sep 17 00:00:00 2001 From: MuK IT GmbH Date: Fri, 12 Oct 2018 08:56:15 +0000 Subject: [PATCH] publish muk_web_client_refresh - 12.0 --- .../data/refresh_actions.xml | 7 -- .../static/description/index.html | 89 +++++++++++-------- .../static/src/js/client_refresh.js | 13 ++- 3 files changed, 59 insertions(+), 50 deletions(-) diff --git a/muk_web_client_refresh/data/refresh_actions.xml b/muk_web_client_refresh/data/refresh_actions.xml index c48497f..0fae857 100644 --- a/muk_web_client_refresh/data/refresh_actions.xml +++ b/muk_web_client_refresh/data/refresh_actions.xml @@ -39,12 +39,5 @@ refresh on_unlink - - - Refresh Users on Creation/Update - - refresh - on_create_or_write - \ No newline at end of file diff --git a/muk_web_client_refresh/static/description/index.html b/muk_web_client_refresh/static/description/index.html index 93200ef..5bad68c 100644 --- a/muk_web_client_refresh/static/description/index.html +++ b/muk_web_client_refresh/static/description/index.html @@ -15,7 +15,7 @@

Overview

-

Adds a channel called "refresh" +

Adds a channel called "refresh" to the web client, which can be used to trigger a view reload without refreshing the browser itself. Furthermore, it allows the user the creation of action rules. These rules can be applied to any @@ -26,9 +26,11 @@

-

Rule View

-
-

+

+

Customize Process

+
+
+

Refresh actions can be created easily inside of Odoo. The view to create such rules is located under "Settings" "Technical" "Automated Refresh".

-
-
- +
+
+
+ +
+
+
-

Chatter Support

-
- -
-
-

The module also has support for +

+

Customize Process

+
+
+
+ +
+
+
+

The module also has support for the Odoo Chatter Widget. As soon as a new message or activity is created, a corresponding refresh message is sent.

+
+
-
-

Demo

-
-
-
User:
-
-
-
apps
-
-
-
Password:
-
-
-
demo
-
-
+

Demo

+
+
+
User:
+
+
+
apps
+
+
+
Password:
+
+
+
demo
+
+
- Live Preview + style="position: relative; overflow: hidden;"> + Live Preview +
@@ -92,13 +103,13 @@ - + \ No newline at end of file diff --git a/muk_web_client_refresh/static/src/js/client_refresh.js b/muk_web_client_refresh/static/src/js/client_refresh.js index d1cfdfb..d024b6d 100644 --- a/muk_web_client_refresh/static/src/js/client_refresh.js +++ b/muk_web_client_refresh/static/src/js/client_refresh.js @@ -24,6 +24,7 @@ var config = require('web.config'); var session = require('web.session'); var WebClient = require('web.WebClient'); +var BusService = require('bus.BusService'); WebClient.include({ start: function () { @@ -31,12 +32,13 @@ WebClient.include({ var load_config = this._rpc({ route: '/config/muk_web_client_refresh.refresh_delay', }).done(function(result) { - self.refresh = _.throttle(self.refresh.bind(self), result.refresh_delay || 1000, true); + self.refresh_delay = result.refresh_delay; + self._reload = _.throttle(self._reload, self.refresh_delay || 1000); }); return $.when(this._super.apply(this, arguments), load_config); }, show_application: function() { - this.bus_declare_channel('refresh', this.refresh); + this.bus_declare_channel('refresh', this.refresh.bind(this)); return this._super.apply(this, arguments); }, refresh: function(message) { @@ -46,12 +48,15 @@ WebClient.include({ action && controller && controller.widget.modelName === message.model && controller.widget.mode === "readonly") { if(controller.widget.isMultiRecord && (message.create || _.intersection(message.ids, action.env.ids) >= 1)) { - controller.widget.reload(); + this._reload(message, controller); } else if(!controller.widget.isMultiRecord && message.ids.includes(action.env.currentId)) { - controller.widget.reload(); + this._reload(message, controller); } } }, + _reload: function(controller) { + controller.widget.reload(); + }, }); });