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();
+ },
});
});